unrolled

Unroll for-loops at compile-time.

Pure Nim score 15/100 · tests present · no docs generated

Summary

Latest Version Unknown
License MIT
CI Status Failing
Downloads 0
Last Indexed 2026-07-21 05:25

Installation

nimble install unrolled
choosenim install unrolled
git clone https://github.com/schneiderfelipe/unrolled

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
unrolled - - - - - - -

Source

Repository https://github.com/schneiderfelipe/unrolled
Homepage https://github.com/schneiderfelipe/unrolled
Registry Source nimble_official

README

WARNING: this project has been retired. For a Rust-based alternative, see crunchy.

unrolled

Unroll for-loops at compile-time.

var total: int
unroll for i in 1..3:
  total += i

The above generates the following code (check with expandMacros)

var total: int
block:
  total += 1
block:
  total += 2
block:
  total += 3

(The usage of blocks ensure variables never "leak".)

Note: currently, we have two serious known bugs, one regarding variable definitions in the loop body (see #1), and one about nested loops (see #2). I expect to solve them some time soon.

Installation

unrolled supports Nim 1.0.0+ and can be installed using Nimble:

$ nimble install unrolled

Other projects