|
|
|
|
|
by rikthevik
416 days ago
|
|
Came here for the Uniform function call syntax link. This is one of the little choices that has a big impact on a language! I love it! I wrote a little pipeline macro in https://nim-lang.org/ for Advent of Code years ago and as far as I know it worked okay. ```
import macros macro `|>`\* (left, right : expr): expr =
result = newNimNode(nnkCall)
case right.kind
of nnkCall:
result.add(right[0])
result.add(left)
for i in 1..<right.len:
result.add(right[i])
else:
error("Unsupported node type")
```Makes me want to go write more nim. |
|