This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/compiler/ast.nim b/compiler/ast.nim | |
index bdb8d1c..b0d869c 100644 | |
--- a/compiler/ast.nim | |
+++ b/compiler/ast.nim | |
@@ -847,7 +847,7 @@ type | |
const | |
OverloadableSyms* = {skProc, skMethod, skIterator, skClosureIterator, | |
- skConverter, skModule, skTemplate, skMacro} | |
+ skConverter, skModule, skTemplate, skMacro, skType} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(0, 1), (1, 5), (2, 8), (3, 6), (4, 3), (5, 7), (6, 2), (7, 4)(0, 1), (1, 6), (2, 8), (3, 3), (4, 7), (5, 4), (6, 2), (7, 5)(0, 1), (1, 7), (2, 4), (3, 6), (4, 8), (5, 2), (6, 5), (7, 3)(0, 1), (1, 7), (2, 5), (3, 8), (4, 2), (5, 4), (6, 6), (7, 3)(0, 2), (1, 4), (2, 6), (3, 8), (4, 3), (5, 1), (6, 7), (7, 5)(0, 2), (1, 5), (2, 7), (3, 1), (4, 3), (5, 8), (6, 6), (7, 4)(0, 2), (1, 5), (2, 7), (3, 4), (4, 1), (5, 8), (6, 6), (7, 3)(0, 51)(0, 2), (1, 7), (2, 3), (3, 6), (4, 8), (5, 5), (6, 1), (7, 4)(0, 51)(0, 49)(0, 3), (1, 5), (2, 8), (3, 4), (4, 1), (5, 7), (6, 2), (7, 6)(0, 49)(0, 4390240), (1, 2), (2, 7), (3, 8236), (4, 4), (5, 4390240), (6, 1), (7, 7), (8, 41), (9, 4), (10, 4390240), (11, 1), (12, 7), (13, 40), (14, 4), (15, 4390240), (16, 2), (17, 7), (18, 8236), (19, 4), (20, 4390240), (21, 1), (22, 7), (23, 41), (24, 4), (25, 4390240), (26, 1), (27, 7), (28, 40), (29, 4), (30, 4390240), (31, 2), (32, 7), (33, 8236), (34, 4), (35, 4390240), (36, 1), (37, 7), (38, 41), (39, 4)(0, 67527080), (1, 0), (2, 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proc cst*[T1, T2](item: T1, desc: typedesc[T2]): T2 = | |
T2(item) | |
proc arange*(n: int, T: typedesc): seq[T] = | |
result = newSeq[T](n) | |
for i, val in result: | |
result[i] = 0.cst(T) | |
discard arange(10, float) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Option one | |
proc procedureWithlotsOfArgumentsAndAReallyLongName( | |
argOne: string, argTwo: int, argThree: float, | |
argFour: proc(), argFive: bool): returnType | |
# Option two | |
proc procedureWithlotsOfArgumentsAndAReallyLongName( | |
argOne: string, argTwo: int, argThree: float, | |
argFour: proc(), argFive: bool): returnType |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type | |
Matrix[W, H] = array[1..W, array[1..H, float]] | |
let mat1 = [[1, 0], | |
[0, 1]] | |
let mat2 = [[0, 1], | |
[1, 0]] | |
proc add[W, H](a, b: Matrix[W, H]): | |
Matrix[W, H] = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unsigned, math | |
type | |
Random* = generic x | |
next(var x) is uint64 | |
proc next*[T](self: var T, n: int): int = | |
## Gets a random number in [0, n). This wastes entropy, so it should | |
## be used with caution in cases where randomness can be exhausted | |
assert n > 0 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unsigned | |
import strutils | |
type | |
BigIntDigits=seq[uint32] #a sequence of digits used for a big integer | |
BigInt* =object | |
digits*:BigIntDigits #posetive digits in base maxvalue(uint)+1 | |
neg*:bool #true if negative, false if zero or posetive |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* | |
!**/ | |
!*.* | |
nimcache/ | |
*.o | |
*.exe | |
*.so | |
*.dylib | |
*.zip |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unsigned | |
type | |
TBigInt* = object | |
d: seq[uint32] ## index 0 is the least significant int32 | |
## index len-1 is the most significant int32 | |
sign: TSign | |
TSign* {.pure.} = enum Negative, Zero, Positive | |
proc addCarry(a, b: uint32): tuple[res: uint32, carry: uint32] = |