Edward Cherlin Paper

Pure functions in APL and J

https://dl.acm.org/doi/10.1145/114055.114065

Jared.

On Sat, Jul 2, 2022 at 12:21, Jacques Bailhache <jacques.bailha...@gmail.com> 
wrote:

> I am trying to implement combinatory logic in J. I succeeded for
> combinators I and K :
>
> ap =: 4 : 'x @.(]@1) y'
> I =: ]`]
> I ap 5
> 5
> K =: ]`(3 : ']`(]@y)')
> (K ap 6) ap 8
> 6
>
> but I don't see how to implement the combinator S.
> It must satisfy :
> ((S ap a) ap b) ap c = (a ap c) ap (b ap c)
> For example :
> ((S ap add) ap double) ap 10 = (add ap 10) ap (double ap 10)
> where add and double are defined as follow :
>
> add =: ]`(3 : ']`(+ & y)')
> (add ap 3) ap 5
> 8
> double =: ]`+:
> double ap 10
> 20
> (add ap 10) ap (double ap 10)
> 30
>
> I found that (S ap add) ap double = ]`((add & ap) ap (double & ap)) :
>
> (]`((add & ap) ap (double & ap))) ap 10
> 30
>
> The next steps consists in defining S ap add by abstracting double from
> this expression, but I don't see how to do this.
> Does someone have an idea ?
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to