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

29 questions
14
votes
2 answers

Does the function monad really offer something more than the function applicative functor? If so, what?

For the function monad I find that (<*>) and (>>=)/(=<<) have two strikingly similar types. In particular, (=<<) makes the similarity more apparent: (<*>) :: (r -> a -> b) -> (r -> a) -> (r -> b) (=<<) :: (a -> r -> b) -> (r -> a) -> (r -> b) So…
Enlico
  • 23,259
  • 6
  • 48
  • 102
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
  • 329
  • 1
  • 3
  • 10
7
votes
1 answer

Expressing Y in term of SKI-Combinators in JavaScript

I was fiddling with combinators 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…
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…
7
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
  • 6,222
  • 12
  • 56
  • 98
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

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,778
  • 15
  • 22
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,094
  • 10
  • 16
3
votes
0 answers

Is there a way to express the function application operator/function with Hana?

My question I'm referring to a function which does essentially the following (modulo const, &, perfect forwarding, or whatever is appropriate): auto constexpr dollar = [](auto f, auto x){ return f(x); }; // Why calling it "dollar"? Keep…
Enlico
  • 23,259
  • 6
  • 48
  • 102
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
  • 6,222
  • 12
  • 56
  • 98
3
votes
2 answers

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
  • 1,165
  • 3
  • 13
  • 33
1
2