A Python3 module implementing a Fluent Syntax calculator
This small module was built as an exercise for a job interview. I did not get the job. You shouldn't rely on this code! =D.
It is a calculator that uses the "fluent syntax" as instructed in the exercise.
Both numbers and opperations are attributes of the calculator. To use it, chain them together.
- kata.Cal.new.two.plus.two # returns 4
- kata.Cal.new.three.times.three # returns 9
- kata.Cal.new.three
- kata.Cal.new.two.hundred.times.three # returns 600
- kata.Cal.new.one.times.two.thousand # returns 2000
- kata.Cal.one.plus.two.times.three # returns nine
- kata.Cal.result
- kata.Cal.new
- kata.Cal.one # Returns None
- pass # do something
- kata.Cal.plus # Returns None
- pass # do some other thing
- kata.Cal.two # Returns three
- kata.Cal.one.hundred.twenty.five.times.two.plus.three # Returns 253