Re: [Jprogramming] Combinatory logic in J

2022-07-02 Thread Raul Miller
On Sat, Jul 2, 2022 at 12:21 PM Jacques Bailhache wrote: > 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) Here's one approach: ap=: {{ ({. {{ x`:6 y }} }.) x,y }} I=: ]`'' K=: {{ if. 1<#y do. 1{.y else. K`y end. }}`'' S=: {{

Re: [Jprogramming] Combinatory logic in J

2022-07-02 Thread Jared
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 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

[Jprogramming] Combinatory logic in J

2022-07-02 Thread Jacques Bailhache
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)