Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
mratsim
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
60 ms
·
601.
▲
Show HN: Arraymancer, teaching Nim language digit recognition from scratch
(github.com)
9 points
by
mratsim
9y ago
|
0 comments
602.
▲
by
mratsim
9y ago
Sounds like memory regions in Nim[1] type Memory[T] = object len: int data: ptr UncheckedArray[T] Kernel = object Userspace = object var a: Kernel ptr Memory[int] var b: Userspace ptr Memory[int]
603.
▲
by
mratsim
9y ago
For the last part about economic optimization, I would not approach it with Dynamic Programming. As evidenced by go and many games, doing the "local" best move does not guarantee the best result in the end. If brute-forcing is unt
604.
▲
by
mratsim
9y ago
Oops, I obviously meant "you can" but I probably typed too fast :P
605.
▲
by
mratsim
9y ago
I'd like to add that "circumventing the GC" is supported by default. There are 3 object types in Nim - `type Foo = object` --> Value type, on the stack - `type Foo = ref object` --> Reference type, managed by GC - `type
606.
▲
by
mratsim
9y ago
Nim compiles to C/C++/Objective-C and Javascript and all memory safety is handled on the Nim side. The C/C++ code generated by the Nim compiler is then free to use unsafe constructs including the dreaded goto.
607.
▲
by
mratsim
9y ago
Nim was written in Pascal at the very beginning. But you can't do pointer arithmetics in Nim. Either - `type Foo = object` -> Value type, on the stack - `type Foo = ref object` -> Ref type, managed by GC - `type Foo = ptr object`
608.
▲
by
mratsim
9y ago
Author here, I forgot one thing in the article: Programming in Nim is fun!