No description
Find a file
Nickolay Bukreyev a640c906cb Release v1.1.2
2023-07-09 05:54:32 +07:00
.github/workflows Remove Nim 0.19 from GitHub CI 2023-07-09 05:51:26 +07:00
tests Add one more test for freezeVars 2023-07-09 03:59:53 +07:00
.gitignore Add documentation 2023-03-05 23:19:58 +07:00
letUtils.nim Fix nim doc for old compiler versions 2023-07-09 03:43:08 +07:00
letUtils.nimble Release v1.1.2 2023-07-09 05:54:32 +07:00
License Add a license 2023-03-06 03:27:10 +07:00
nimdoc.cfg Fix nim doc for old compiler versions 2023-07-09 03:43:08 +07:00
Readme.md Add a readme 2023-03-06 03:27:09 +07:00

letUtils

Immutability is good. But one day I got tired of repeating variable names over and over again:

let fib = block: # OK, we are going to declare `fib`.
  var fib = @[0, 1] # I already got it will be `fib`, thanks.
  for i in 2 ..< 13:
    fib &= fib[^1] + fib[^2]
  fib # Once again? Really?

So I wrote a bunch of macros that handle the boilerplate. Now we can do this:

import letUtils

freezeVars:
  var fib = @[0, 1]
  for i in 2 ..< 13:
    fib &= fib[^1] + fib[^2]

echo fib
assert not compiles (fib[0] = 123)

Look at the documentation for more goodies.