/
Cuttings (8 posts)

lang-nim

"...Statically typed compiled systems programming language that combines successful concepts from Python, Ada and Modula."



  1. 11.05.2025
    A Basic Nim Workflow To Metaprogramming/Macros
    Use dumpTree, .repr(), .treeRepr().

  2. 11.05.2025
    Nim Macros - Beginner & Intermediate Exercises
    With detailed notes and thought processes.

  3. 06.05.2025
    Nim / Exercise - `timed(expr)` macro
    Measure and print how long an expression takes to run.

  4. 06.05.2025
    Nim / Exercise - `swap(a, b)` macro
    Swap the values of two variables.

  5. 06.05.2025
    Nim / Exercise - `assertPositive(expr)` macro
    Check if the expression is > 0.

  6. 02.05.2025
  7. 02.05.2025
    Nim / Exercise - Make a double(x) macro
    Take an identifier and generate code that doubles its value in-place.

  8. 02.05.2025
    Nim / Exercise - Make an `info(expr)` macro
    Get familiar with `quote do`.

© Wan Zafran. See disclaimer.