Hacker News new | ask | show | jobs
by CornCobs 811 days ago
What syntax of nim's is the network: ... Used to declaratively construct the neural networks? Is it a macro? Looks really neat!
2 comments

It is a small DSL written using macros at https://github.com/mratsim/Arraymancer/blob/master/src/array....

Nim has pretty great meta-programming capabilities and arraymancer employs some cool features like emitting cuda-kernels on the fly using standard templates depending on backend !

Yes, Nim macros can fiddle with the AST: https://nim-lang.org/docs/macros.html

You can also see another (I think) neat example in `npeg`: https://github.com/zevv/npeg?tab=readme-ov-file#quickstart