Njaml (pronounced en-jamol, rhymes with camel and yaml) is a function piping tool that can be implemented for any programming language. It is based on the easy to read and easy to create yaml structure.
This is yet another attempt at a programming framework that is easy to use, easy to skim, easy to verify, and easier to develop software solutions.
Like YAML, it is hierarchical. In a viewer with collapsing enabled, it is easy to see everything at a high level with the ability to expand sections for as much detail as we want to see.
Can also be useful for debugging, can write the output of each subfunction one by one to a file as a function is ran to see how each step transforms some input.
- Frame problem as desired input and output
- Write a short sequence of high-level abstract tasks that would transform the input to output
- Repeat these 2 steps for each abstract task
- When a simple implementation is available or a more algorithm heavy section occurs, write an implementation of the task in a executable language.
- Write the tasks to an .njaml file
- Load the function structure
- Link the abstract function name to it's executable language implementation where needed
- Add test cases
- Run any function at any level to get results.
file.njaml
outer1
inner11
inner111
inner12
outer2
inner21
example.py
njaml = Njaml()
#Load njaml functions
njaml.load("file.njaml")
njaml.link('inner11',lambda x: x + 2)
njaml.link('inner111',lambda x: x * 2)
njaml.link('inner12',lambda x: x + 2)
njaml.run('outer1',2) # = 10
njaml.run('inner11',2) # = 8
#Add test cases
njaml.set_cases('outer1',[2,3],[10,12])
#run test cases
njaml.run_cases("outer1") # In console: Case 0 passed\n Case 1 passed\n 2 passed.\n 0 failed.