Following the previous posting on similarity between the functional staple map(), and xargs, I was looking more deeply if we can consider bash programming a functional language. In the xarsg example I used before, I used the sh -c trick, which can be said is analogous to eval function in any functional language. Exactly the same can be achieved using the back-tick syntax, give a string as an input, and get the result of evaluation.
So now we have eval, and therefore closures and 'sorta' anonymous functions which can be passed around as strings and evaluated using eval. the pipes tie this all together, allowing to pipe the results from one function to another.
What else do we need to call a language functional? thinking...
No comments:
Post a Comment