Skip to content
This repository was archived by the owner on Jul 27, 2021. It is now read-only.
schneiderfelipePublic archive

About

🧻 Unroll for-loops at compile-time.

Topics

Resources

Stars

12 stars

Watchers

0 watching

Forks

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

🧻 Unroll for-loops at compile-time.

Topics

Resources

Stars

12 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages