News for hackers. Stuff that matters.
Re:Needed 1+1, Built a Functional Programming Language by fodkodrasz on Wednesday September 30, 2026 @02:23AM (#49905142)
> Arrays are hash tables.

Maybe in JavaScript... but there is a topic called datastructures, where arrays are arrays, and hashtables are hastables. If people say this without a flip of an eye I'm not surprised why people write stuff like

> I thought that hash tables were something that were basically impossible to make in C

Re:Needed 1+1, Built a Functional Programming Language by moregrist on Wednesday September 30, 2026 @03:25AM (#49905577)
In a trivial sense, arrays are hash tables with a hash function of the identity f(x)=x.

It’s just not particularly common (or helpful) to view them that way.

Re:Needed 1+1, Built a Functional Programming Language by dprkh on Thursday October 01, 2026 @06:28PM (#49927803)
In LeetCode, it's a very common optimization. If your key values are dense, you use an array. If your key values are sparse, you use a dict.
Re:Needed 1+1, Built a Functional Programming Language by pjmlp on Wednesday September 30, 2026 @04:55AM (#49906195)
Besides the sibling comment, you can used closed hash tables algorithm (open addressing), which is fully based on a single array.

https://en.wikipedia.org/wiki/Open_addressing