wp/Currying
Currying is related to, but not the same as, partial application. Leggere l'idea.
In una visione puramente insiemistica, questa riespressione della corrispondenza non mi solleva problemi, ma se mi pongo in analisi sul campo reale, definisco ga(y):=f(a,y)
dato f:ℝxℝ→ℝ come trattare la continuita'?
Detto in breve: consideriamo una funzione f(x,y) di 2 variabili
bloccando la x ad un fissato valore a, definisce una funzione f(a,y) della sola y
es: f(x,y)= x²+2xy,
fissando x=a=1 produce una fun g2 g1(y)= 1²+2y
fissando x=a=2 produce una fun g3 g2(y)= 2²+2*2y
fissando x=a=a produce una fun ga ga(y)= a²+2ay
fissando x=a=x produce una fun gx gx(y)= x²+2xy
Si stabilisce quindi la corrispondenza
x→gx ad 1 numero corrisponde una funzione
dato f:XxY→Z, ∀a∈X def: ga:Y→Z ga(y):=f(a,y)
e quindi si puo' definire h:X→(Y→Z) h(x):=gx
dato f:XxY→Z, h:X→(Y→Z) h(x):=gx gx(y):=f(x,y)
h(x)(y)=f(x,y)
1 n-arguments-function translated in a sequence of n 1-argument-functions.
by currying is translated into
la pagina italiana wp/Applicazione_parziale (13-5-2020) sembra invece confondere i 2 concetti.
Non esistono operazioni binarie come entri primitivi
es: non si puo' scrivere f(x,y)= x+y o f(x,y)= x*y, bensi'
devono essere costruite a partire da operatori unari, es +3
+3(x) = x+3
is in the closed monoidal categories,
which underpins a vast generalization of the Curry–Howard correspondence of proofs and programs to a correspondence with many other structures, including quantum mechanics, cobordisms and string theory.
developed by Moses Schönfinkel, and further developed by Haskell Curry.
X→Y | all functions fron X to Y the set of functions from the set X to the set Y. the set of all functions from X to Y. Rob: io usavo F(X→Y) |
f:X→Y one of them
Set theory | Function spaces | |
---|---|---|
X→Y | YX | Hom(X,Y) |
XxY→Z | ZXxY | Hom(XxY,Z) |
X→(Y→Z) | (ZY)X | Hom(X,Hom(Y,Z)) |
f: XxY→Z given a funcion f; XxY prodotto cartesiano di X e Y
h: X→(Y→Z) curry construct a new function h whose values are functions
h(x):Y→Z h(x) is a function Y→Z
h(x)(y) = f(x,y)
curry: Hom(XxY,Z) → Hom(X,Hom(Y,Z))
while uncurrying is the inverse map.
ho intrapreso questo approfondimento in relazione a:
che per caso ho trattato a poca distanza di tempo, e che si legavano entrambe a questa tematica.