Skip to content
This repository has been archived by the owner on Oct 24, 2020. It is now read-only.

SamirTalwar/FizzBuzz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 

Repository files navigation

FizzBuzz, Lambda Calculus-style

Inspired by Tom Stuart's excellent talk on programming using just Ruby Procs entitled Programming With Nothing, I thought I'd try the same thing in Java. The idea is to remove all your language features bar two. Quoting Tom, "Naturally that means no gems [a.k.a. libraries—Samir], no standard library, no modules, methods, classes or objects. But this is love, so let’s go all the way: no control flow, no assignment, no arrays, strings, numbers or booleans." The two features we're going to keep are creating procs and calling procs.

We don't really have procs in Java, but we do have lambdas in Java 8, which are roughly the same (and exactly the same for the purposes of this exercise). So way back when, I grabbed the latest version of Project Lambda (which has since become part of Java 8) and gave implementing FizzBuzz (and, by extension, untyped lambda calculus) a crack. The results are pretty cool. Take a look at λs.java for implementations of booleans, numbers, branching and lists, and FizzBuzz.java for an idea of how they work.

I kept classes because, well, you have to in Java, but all methods are static and simply provide an entry point.

I hope this madness entertains you.

About

Reimplementing lambda calculus in Java 8 for fun and profit.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages