Better HN
topnewbestaskshowjobs
Log inSign up

Throwaway234590

-1 karma · joined Dec 20, 2022 (3y ago) · 5 submissions

Submissions

comment 3y ago · link · parent

This year's Advent of Code had a problem where you had to check the visibility of trees in a forest from both sides, (actually four sides, but consider two sides). You needed to read in an entire array of tree heights, and walk back from both sides into the centre to check if each tree was visible.

Because Haskell reads in the entire array before beginning processing, you can create semantics that walk backwards and forwards to solve this problem all in one go. That is what the Tardis monad is about.

comment 3y ago · link · parent

Was this blow up due to a dependency with an 'any' type somewhere, and your code fed the dependency library some garbage? That's what bit me, even with the strictest ts settings, this can't be picked up by tsc.

comment 3y ago · link · parent

It's a hairpulling experience trying to write functionally in javascript. All those imperative apis like sort as you mention. I will sometimes copy as in [...xs] but I always feel like I am swimming against the current. Plenty more to say but it appears this node has been flagged, it appears HN censors criticism. Saddening.

comment 3y ago · link · parent

Is the problem you mentioned not fixed by collision prediction? Check out ourcade on youtube, if you don't already know what this is, he has a video on it.