sugar deep dive
TLDR
- the sweetest nim syntax
- the fusion pkg provides additional sugar, but its modules are dispersed through other files
- working with data structures (e.g. sorting) generally requires std/algorithm
links
- high impact
- niche
TODOs
- std/wrapnils: optional chaining
- macro capture(locals: varargstyped; body: untyped): untyped
- capture local variables for use in a closure
- macro dump(x: untyped): untyped
- macro dumpToString(x: untyped): string
- macro dup[T](arg: T; calls: varargsuntyped): T
- echo for debugging expressions, prints the expression textual representation
- std/algorithm
- then review all the sort procs for each datatype (they all depend on algo)
do blocks and proc fn signatures
- do blocks can be considered an alias for block:
- proc expressions can use do notation when passed as a parameter to a proc
- can also be used to pass multiple blocks to a macro
- i.e.
- do with paranthesis is an anonymous proc
- do without paranthesis is just a block of code
sugar
sugar procs
- -> for type defs in proc signatures
- => for lambdas
Consts
myHashSet = (data: [(0, 0), (0, 0), (0, 0), (-5492552493630111101, 4), (0, 0), (0, 0), (6628840058955693702, 5), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (-8667131158406858863, 3), (0, 0), (0, 0), (6130242188011939732, 2), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (510521829891512613, 6), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (8641844181895329213, 1), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (7204881626893065923, 9), (0, 0), (0, 0), (-7855962892973491642, 7), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (-6375197177782184730, 10), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (5112299225816896374, 8), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0)], counter: 10)
- Source Edit
myTable = (data: [(0, 0, 0), (0, 0, 0), (0, 0, 0), (-5492552493630111101, 4, 8), (7204881626893065923, 9, 18), (0, 0, 0), (6628840058955693702, 5, 10), (-7855962892973491642, 7, 14), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (-8667131158406858863, 3, 6), (0, 0, 0), (0, 0, 0), (6130242188011939732, 2, 4), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (510521829891512613, 6, 12), (-6375197177782184730, 10, 20), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (5112299225816896374, 8, 16), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (8641844181895329213, 1, 2), (0, 0, 0), (0, 0, 0)], counter: 10)
- Source Edit