# Combinators

Page 1 of 1

## 2 Replies - 2386 Views - Last Post: 06 October 2013 - 03:27 PM

### #1 Lemur

• Pragmatism over Dogma

Reputation: 1439
• Posts: 3,609
• Joined: 28-November 09

# Combinators

Posted 06 October 2013 - 02:58 PM

So I've been asking around with my Math friends and most of them are scratching their heads trying to figure out what the devil I'm on about. I've managed to stumble upon a very interesting branch of math called Combinatory Logic, and while it's enchanting and very powerful, I'm wondering what others opinions are on it.

https://leanpub.com/combinators

This book does a good job of describing implementations in Ruby.

Seems that Haskell describes it in depth too.

What I'm wondering is why, if this is so useful and potent in abstracting common logic patterns, is it not more ubiquitous? Granted it has its difficulty, but still.

Here's a quick example of what I'm talking about, a Kestrel (K Combinator) in Ruby:

```# The usual way
def registered_person(params = {})
person = Person.new(params.merge(:registered => true))
Registry.register(person)
person
end

# Kestrel
def registered_person(params = {})
returning Person.new(params.merge(:registered => true)) do |person|
Registry.register(person)
end
end

```

Quote

In Combinatory Logic, a Kestrel (or “K Combinator”) is a function that returns a constant function, normally written Kxy = x.

It's powerful stuff, and quite beautiful at that. Anyone heard of this or want to provide some more insight to this branch?

Is This A Good Question/Topic? 1

## Replies To: Combinators

### #2 macosxnerd101

• Games, Graphs, and Auctions

Reputation: 12317
• Posts: 45,417
• Joined: 27-December 08

## Re: Combinators

Posted 06 October 2013 - 03:08 PM

Moved to Computer Science.

I'll be honest, I haven't really studied Combinatory Logic. I'm taking a Theory of Computation course this semester. The first day of class, several models of computation were introduced, including lambda calculus, recursive function theory (combinatory logic falls under this category), logic circuits, the von Neumann model, and a few others. The professor described them all as equivalent. He teaches this class using Circuits as the model of computation, which yields a more EE flavor than I'd like. His motivation for using circuits is that it's a model which students can see (as in, circuits are implemented in the mother board, so it should follow that if something can't be computed with circuits, it isn't computable on these other, more abstract models).

Combinatory logic really isn't taught in lower level CS and Math courses. I don't even think Abstract Algebra focuses on it too much. That's probably the problem in getting it out there.

### #3 Lemur

• Pragmatism over Dogma

Reputation: 1439
• Posts: 3,609
• Joined: 28-November 09

## Re: Combinators

Posted 06 October 2013 - 03:27 PM

I just know that any time I stumble on something and it near redefines the way I think about programming it's definitely significant and warrants more investigation on my part.