News for hackers. Stuff that matters.
Re:I Love OCaml by int_19h on Friday November 07, 2025 @05:40PM (#45852067)
The reason why functional languages like linked lists so much is because they are very easy to make immutable without a lot of pain all around. If you implement an immutable vector in a straightforward way, though, you basically need to do a lot of copying for any operation that needs to construct one (the rigmarole with immutable strings, and existence of hacks such as StringBuilder, is a good illustration of the problem).

But you can have a data structure that is more like vector under the hood while still supporting efficient copy-with-modifications. Clojure vectors, for example.

Re:I Love OCaml by gigatexal on Saturday November 08, 2025 @02:19AM (#45854820)
That makes sense. But LinkedIn lists are horrible for cache efficient things no? I think there was an article on HN from a Golang perspective padding structs or something such that they are efficient wrt to cache hits.
Re:I Love OCaml by rkomorn on Saturday November 08, 2025 @02:26AM (#45854846)
> But LinkedIn lists are horrible for cache efficient things no?

LinkedIn Lists you say? (Sorry. (But not that sorry.))

Edit meta sidenote: in this modern meme world, it's virtually impossible to know if a typo is a typo or just a meme you haven't heard of yet.

Re:I Love OCaml by gigatexal on Saturday November 08, 2025 @04:31AM (#45855438)
lol my phone autocorrected ugh.

But you know what I mean. Some grace would be nice.

Re:I Love OCaml by rkomorn on Saturday November 08, 2025 @05:08AM (#45855605)
I know. It was just too hard to pass up. :)
Re:I Love OCaml by gigatexal on Saturday November 08, 2025 @06:18AM (#45855889)
Well you got me. I audibly groaned and slapped my forehead.
Re:I Love OCaml by stirfish on Saturday November 08, 2025 @01:45PM (#45858915)
LinkedIn lists will tell you they contain one new element, but you have to click on a link and scroll through their suggested new elements to see what it is
Re:I Love OCaml by rkomorn on Saturday November 08, 2025 @01:48PM (#45858936)
Do they also always end with an element that tells you what the LinkedIn list taught it about B2B sales?
Re:I Love OCaml by mrkeen on Saturday November 08, 2025 @05:32PM (#45860647)
They are, but you don't tend to keep them around in memory long enough. Start consuming the front before you produce the back.
Re:I Love OCaml by dontlaugh on Saturday November 08, 2025 @03:44AM (#45855191)
Which is a pity, you can fit entire small arrays in a cache line to end up with no pointer chasing at all.