Fixing my mistake:
> lambda=:3 :0
> if. 1=#;:y do.
> 3 :((y,'=.y');<;._2]0 :0)`''
> else.
> (,<#;:y) Defer (3 :(('''',y,'''=.y');<;._2]0 :0))`''
> end.
> )
>
> Defer=:2 :0
> if. (_1 {:: m) <: #m do.
> v |. y;_1 }. m
> else.
> (y;m) Defer v`''
> end.
> )
>
> Note''
> single letter words which follow have meaning beyond
> this message and outside the J language.
> Search for "S combinator" for details and examples.
> )
>
> I=: lambda 'x'
> x
> )
>
> K=: lambda 'x y'
> y
> )
That was wrong, it should be:
K=: lambda 'x y'
x
)
> S=: lambda 'x y z'
> (x`:6 z)`:6 y`:6 z
> )
>
> I think I got that right -- I tried finding examples, but people
> discussing this system seem to be shy about using examples.
>
> Anyways, here's an example of how to achieve the above identity gerund
> I in terms of S and K:
>
> I`:6 'a'
> a
> (((S`:6 K)`:6 K)`:6 K)`:6 'a'
> a
With the corrected definition for K, this becomes:
((S`:6 K)`:6 K)`:6 'a'
a
FYI,
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm