Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/codecop/fizzbuzz-with-nothing-kata
Exercise to practice working with functions.
https://github.com/codecop/fizzbuzz-with-nothing-kata
exercise functional-programming kata lambda-calculus
Last synced: 23 days ago
JSON representation
Exercise to practice working with functions.
- Host: GitHub
- URL: https://github.com/codecop/fizzbuzz-with-nothing-kata
- Owner: codecop
- License: bsd-3-clause
- Created: 2022-09-08T07:34:21.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-09-08T16:10:01.000Z (over 2 years ago)
- Last Synced: 2024-11-06T10:41:38.975Z (2 months ago)
- Topics: exercise, functional-programming, kata, lambda-calculus
- Language: TypeScript
- Homepage:
- Size: 6.84 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FizzBuzz with Nothing Kata
Exercise to practice working with functions.
## Assignment: FizzBuzz
Write a program that prints the numbers from 1 to 100.
But for multiples of three print "Fizz" instead of the number and
for the multiples of five print "Buzz".
For numbers which are multiples of both three and five print "FizzBuzz".### Sample Solution
for (int i = 1; i <= 100; i++) {
if (i % 3*5 == 0)
print("FizzBuzz");
else if (i % 3 == 0)
print("Fizz");
else if (i % 5 == 0)
print("Buzz");
else
print(Integer.toString(i));
}## Constraint: With Nothing
We are allowed to
* Create functions with one argument
* Call functions and return a result
* Assign functions to names (abbreviate as constants)We are not allowed to
* Use numbers, booleans, strings, arrays, etc.
* Create objects, control flow, assignment, etc.
* Use the Standard Library## Your Task
Implement FizzBuzz "with nothing". Buw how do we represent numbers, booleans, etc. using no data, only code? All we can do is make or call a function. This exercise is hard.
### What do we need for FizzBuzz
* Numbers: constant values 0, 1, 3, 5, 15, 100; Adding 1, Mod (needs Div needs Sub)
* Booleans: True, False, If-Then-Else, a loop; predicates to compare two numbers <=, equality to zero
* Characters (are numbers using ASCII)
* Strings (needs List needs Pair)
* Print strings (use Console.log)
* Convert numbers to string## License
[BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause), see `LICENSE` in repository.