Quarry and compiler design

This is a homework question:

Explain the conversion of the type of procedure undergoing partial parameterization.

I still understand curry. But I can not find any resources about how such a function is implemented by the compiler in memory. Can I point in the right direction, perhaps keywords for searching or linking to resources, or perhaps explaining here how the compiler generates the type and symbol table among other things related to the question.

Thanks.

+3
source share
2 answers

Currying is the conversion of n argument functions to n unary functions:

, F:: t1 t2 t3 →

f1 :: t1 -> (t2 -> (t3 -> t))

, f1 , t1 f2.

f2 :: t2 -> (t3 -> t)

f2 , t2 f3.

f3 :: t3 -> t

f3 - , t3 t.

, f (a, b, c) = a + b * c, :

f3(C) == c1+c2*C where c1 and c2 are constant.
f2(B) == f3(C) where c1 is constant and c2 is replaced with B.
f1(A) == f2(B) where c1 is replaced with A.

, , .

+4

Currying . , , - , ... , , retn_type function(param1, param2), , retn_type(param2), - .

, - , . , retn_type(param2), , , 1 curryfication.

0

Source: https://habr.com/ru/post/1721605/


All Articles