On 08/05/2011, at 10:31 PM, Rhythmic Fistman wrote:
> You take a function f:a->b and wrap a up to get a new function with no
> arguments, like this:
>
> g:1->b?
It's a closure, or a specialisation, or perhaps even a projection.
Basically you're taking some domain a and a function
k: c -> a
and composing them:
g (x) = f ( k (x) )
or just
g = f . k (in forward notation)
In your case you picked
k: 1 -> a
so the composition is g: 1 -> b
>
> Is that 1 standard notation?
In category theory, yes. 1 is "unit", a canonical type with 1 value.
In Felix that value is (), the empty tuple. In set theory, any set
{x}
is a unit (singleton). Note this is not the same as 0, aka void,
the type with NO values, or the empty set.
A function
f: 1 -> A
is sometime called an "constant function" because it picks out
a single element from A. For example:
twenty: 1 -> Z given by
twenty () = 20
A function
v: 0 -> A
is sometimes called the characteristic function of A, since it is THE
unique function from the empty set to A.
> I picked it up from Felix.
In Felix, 0,1,2,3,4 .. etc are sums of n units eg 2 = 1 + 1 aka "bool",
a type with two values.
Unfortunately + is not associative: the type 2 + 1 is not equal to 3
(although they're isomorphic). Similarly tuple formation * isn't associative:
(1,(2,3)) != (1,2,3) != ((1,2),3)
BTW the names of values of a unit sum in Felix are like
case 0 of 2 (aka "false")
case 1 of 2 (aka "true")
You can find these definitions in the library. Note case numbers are
unfortunately
zero origin, there's no case 2 of 2 even though that reads better ;(
For symmetry with C arrays.
--
john skaller
[email protected]
------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today. Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language