Questions tagged [combinatory-logic]

Combinatory logic is a model of computation equivalent to the lambda calculus, but without abstraction.

Combinatory logic is a model of computation equivalent to the lambda calculus, but without abstraction.

It was introduced by Moses Schönfinkel and Haskell Curry, and has more recently been used in as a theoretical model of computation and also as a basis for the design of languages. It is based on combinators, which are that use only function application and earlier defined combinators to define a result from its arguments.

See also

24 questions
9
votes
1 answer

Type inference for a scala combinator calculus data model

I'm trying out a very light-weight encoding of combinator calculus in scala. Initially, I'm simply implementing the S and K combinators, application and constant values. Later I hope to lift scala functions in and allow evaluation of an expression…
drdozer
  • 279
  • 1
  • 3
  • 9
8
votes
2 answers

Haskell Interpreter for System T Combinator Language

In a previous question SystemT Compiler and dealing with Infinite Types in Haskell I asked about how to parse a SystemT Lambda Calculus to SystemT Combinators. I decided to use plain algebraic data types for encoding both the SystemT Lambda calculus…
CMCDragonkai
  • 5,369
  • 10
  • 47
  • 85
7
votes
1 answer

Find Haskell functions f, g such that f g = f . g

While learning Haskell, I came across a challenge to find two functions f and g, such that f g and f . g are equivalent (and total, so things like f = undefined or f = (.) f don't count). The given solution is that f and g are both equal to \x -> x…
6
votes
1 answer

What does this combinator do: s (s k)

I now understand the type signature of s (s k): s (s k) :: ((t1 -> t2) -> t1) -> (t1 -> t2) -> t1 And I can create examples that work without error in the Haskell WinGHCi tool: Example: s (s k) (\g -> 2) (\x -> 3) returns 2. Example: s (s k)…
6
votes
1 answer

Expressing Y in term of SKI-Combinators in JavaScript

I was fiddling with Cominators in JavaScript and was being proud of (hopefully) getting S to work when I stumbled upon Wikipedia saying: "The Y combinator can be expressed in the SKI-calculus as: Y = S (K (S I I)) (S (S (K S) K) (K (S I I)))", so I…
6
votes
1 answer

Implementing Smullyan's arithmetical birds in Haskell

While searching for information on Raymond Smullyan's To Mock a Mockingbird, I stumbled upon Stephen Tetley's Haskell code for the basic combinators. I thought it was an interesting idea and decided to implement the "birds that can do arithmetic"…
5
votes
3 answers

The type signature of a combinator does not match the type signature of its equivalent Lambda function

Consider this combinator: S (S K) Apply it to the arguments X Y: S (S K) X Y It contracts to: X Y I converted S (S K) to the corresponding Lambda terms and got this result: (\x y -> x y) I used the Haskell WinGHCi tool to get the type signature…
5
votes
1 answer

Implementing the combinator calculus

Concept I am implementing an interpreter that allows a user to define arbitrary combinators and apply them to arbitrary terms. For example, a user may define the Church encoding for pairs by inputting the following combinator definitions: pair a b c…
4
votes
1 answer

Express XOR in SKI combinators

I am trying to solve sure but can you SKI on codewars. It is about to express lambda in SKI combinators. Source is at https://repl.it/@delta4d/SKI. After some researching, especially the Combinatory Logic, I am able to solve all the cases except…
delta
  • 3,643
  • 13
  • 21
4
votes
1 answer

How to parse string into GADT

I am trying trying to implement Combinatory Logic in Haskell, and I would like to write to parser for the language. I am having trouble getting a parser to work via Parsec. The basic problem is that I need a way to ensure that the objects returned…
Eyal
  • 1,104
  • 8
  • 16
3
votes
1 answer

SystemT Compiler and dealing with Infinite Types in Haskell

I'm following this blog post: http://semantic-domain.blogspot.com/2012/12/total-functional-programming-in-partial.html It shows a small OCaml compiler program for System T (a simple total functional language). The entire pipeline takes OCaml syntax…
CMCDragonkai
  • 5,369
  • 10
  • 47
  • 85
3
votes
1 answer

Can XOR be expressed using SKI combinators?

I have question about SKI-Combinators. Can XOR (exclusive or) be expressed using S and K combinators only? I have True = Cancel False = (Swap Cancel) where Cancel x y = K x y = x Swap: ff x y = S ff x y = ff y x
3
votes
3 answers

Lambda-Calculus Representation in NLTK CCG

I am trying to implement a probabilistic ccg with lambda-calculus features. Basically i want to do the following code: >> lex = parseLexicon(r''' :- S,NP He => NP {sem=\x.he(x)} [1.0] Walks => S\NP {sem=\X. walk(X)} [1.0] There => S\S {sem=\x .…
ayyayyekokojambo
  • 965
  • 2
  • 10
  • 28
3
votes
1 answer

Pattern in point-free combinator, how related to SKI calculus

As an exercise, I converted the following combinator to point-free notation: h f g x y z = f x (g y z) with the usual convention of f, g, h as functions, and x, y, z as expressions. (This is not a homework problem, but just for fun and to see if I…
3
votes
2 answers

define a form as function name?

I'd like to know what this code means in Scheme: (define ((K x) y) x) (define (((S x) y) z) ((x z) (y z))) The whole file is here. Is this legal Scheme? Is (K x) a parametrized function, something like generic functions in Java? I looked up the…
1
2