7 ms·
> C doesn't have linked lists in its standard library probably because there is a myriad of ways of doing linked lists with different performance, stylistic and
by lisper 7y ago
> C doesn't have linked lists in its standard library probably because there is a myriad of ways of doing linked lists with different performance, stylistic and other trade-offs.
No, that's not why. The fact that there are myriad ways to implement linked lists is a fact independent of any programming language. And yet Lisp somehow manages to offer linked lists as a native part of the language.
The reason C cannot be extended in this way is that its memory model precludes it. You can't add GC to C because of the way that pointers work.
> C++ certainly provides lists.
Yes. Many languages do. Nonetheless, my original claim, that it is easier to work around Lisp's limitations than those of other languages, stands.
- kazinator 7y agoC's memory model also precludes decent string handling also, yet it has a string library. But that's it; the only other data structuring provided is the qsort function for sorting arrays and bsearch for searching them. I think it's deliberate. It looks like ISO C tends to avoid specifying new library features that can (and likely would be) be written entirely in C.
- lisper 7y ago> it has a string library But not a decent one :-)
- jstimpfle 7y agoMaking the point. C is not a language for convenient canned solutions. But I'm not too sad about that. There are a myriad ways of doing strings, and most high-level programming languages are still stuck in the 90s with UCS-2 encodings or such, and offering only solutions that don't scale well for, say, dozens of megabytes of strings. C isn't stuck, at the cost of convenience.
- kazinator 7y agoI did say "precludes decent string handling"!