4 ms·
I don't understand, this gives C style for loops with C syntax?
by ihatepython 4y ago
I don't understand, this gives C style for loops with C syntax?
- __jem 4y agolooks like it to me cfor(setv(i, 0), i < 10, i += 1) { print(i) }
- ihatepython 4y agoDo the brackets actually work or do you still have to get the indentation right?
- __jem 4y agono, just saying you can trivially convert any lisp code to c style syntax by moving the function call parenthesis to the right and converting wrapping parens into curly braces.
- epr 4y agoThis adds c style for loops to hy, which runs on the normal cpython vm, and therefore can make use of the thousands of open source python libraries available. My reply to the post was tongue in cheek. The point is that you can add on arbitrary language features to python using hy (any lisp, really). The syntax in question is normally referred to as an s-expression.