695 karma · joined January 12, 2018
My email is on my home page at the bottom.
$ bat 2.ts
───────────────
1 │ function one() {
2 │ let x = 1;
3 │ defer (() => { throw new Error("thrown from one!"); })()
4 │ x = 2;
5 │ }
6 │ one();
─────┴─────────
$ node 2.js
~/healeycodes-typescript-go/2.js:29
throw _errors_1[0];
^
Error: thrown from one!
at _callee_1 (/Users/andrew/Documents/GitHub/healeycodes-typescript-go/2.js:9:46)
at /Users/andrew/Documents/GitHub/healeycodes-typescript-go/2.js:10:33
at one (/Users/andrew/Documents/GitHub/healeycodes-typescript-go/2.js:22:31)
at Object.<anonymous> (/Users/andrew/Documents/GitHub/healeycodes-typescript-go/2.js:34:1)
at Module._compile (node:internal/modules/cjs/loader:1830:14)
at Object..js (node:internal/modules/cjs/loader:1961:10)
at Module.load (node:internal/modules/cjs/loader:1553:32)
at Module._load (node:internal/modules/cjs/loader:1355:12)
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
at Module.executeUserEntryPoint [as runMain (node:internal/modules/run_main:154:5)
Node.js v24.15.0> When I read Allan and Kennedy my impression was that vectorising arbitrary imperative code is a much harder problem than designing a language that only allows for vectorisable constructs to be expressed in the first place.
Yeah, I buy this.
> In my example that would produce different code, requiring a multiplication:
lambda i: table[(phase0 + i*inc) % TABLE_LEN]
I think some compilers may lower this without the multiplication.. (e.g. turning it back into an induction variable) but with floats they may not be allowed to, since repeated addition and "phase0 + i*inc" are not strictly equal.IIRC readline uses a `char *` internally since the length of a user-edited line is fairly bounded.
For side-projects, I have to ask myself if I'm writing a parser, or if I'm building something else; e.g. for a toy programming language, it's way more fun to start with an AST and play around, and come back to the parser if you really fall in love with it.
```lisp
(+ 1 2)
```
However, this is a very relevant point. If the goal is just shorter code (as opposed to a mix of shorter code and less run-time operations), then you need to check that folding strings (and similar types) actually makes the expression shorter to represent.
People email me about things I’m interested in, and I’ve made new friends through it too.
It's nice to look back and see my progress — taking on harder projects, and writing more clearly.
> Does the time spent writing feels worth it to you?
Yes but I've always enjoyed writing.
> Did it help to get noticed/ find jobs or other opportunities?
Yes.
> Do you learn something new from it?
Yes, by writing for it. And, I suppose, by "running it" I learned more about the frameworks I've used.
I like this blog on that topic:
https://calpaterson.com/bicycle-threat-model.html
> One father I know had his primary-school-age daughter "decorate" his commuting bicycle with girly stickers and pink glitter. If anyone examines his bicycle closely he looks like a complete loon but I think his motivation is right: it's going to be much less appealing to steal when it's covered in Miffy stickers.
From the paper's abstract:
> the algorithm uses storage in a way that permits an efficient use of magnetic tape
It's the optimal solution to https://leetcode.com/problems/majority-element/ – as in it's required to solve the problem in linear time and in O(1) space.
I’ll see if I can make that clearer — thanks.
I've received two emails from readers:
- One suggested converting RGB to a color space that better matches human visual perception, like CIELAB.
- Another suggested compressing the color space by using K-means clustering (by guessing K as the number of threads)
It's very thorough, written with care, and presented in a way that makes sense. Even as an intermediate Python programmer, I found use in this book.
So I'm trying to fill that gap and help out anyone who is trying to learn the basics.
I recommend playing against https://lichess.org/@/TuroBot which is based on Alan Turing's https://en.wikipedia.org/wiki/Turochamp
I debugged my bot by playing it on lichess since I'm so used to the UI/analysis tools.
I found Ebiten very easy to build a simple project with. The project maintainer is helpful, kind, and highly responsive too.
There is a #ebiten channel in the Gophers slack that is quite active.
-