3

Looking for some data structures for elisp, I came across this. But then this warns me off -- without specifying exactly what replaces elib. So where do I get packages to do doubly linked lists?

Drew
  • 75,699
  • 9
  • 109
  • 225
147pm
  • 2,907
  • 1
  • 18
  • 39
  • 3
    If you are asking the overly general question of how to find replacements for all that was in that grab-bag, then the question should be closed as **too broad** (and you already answered it by the links you gave - nothing "exactly replaces it"). If you are asking for a package that supports doubly linked lists, then rephrase and retitle the question. – Drew Dec 15 '15 at 15:48
  • 1
    The core of elib seems to be stack, queue, doubly linked list, binary, and AVL trees. Should I ask a separate question for each? I was actually hoping somebody knew of a new elib-like package -- similar to how `cl-lib` replaces `cl`. I guess there is no such beast? Since my original question is black-or-white, not opinion, I don't see how it is "too broad." Maybe it's "too big?" – 147pm Dec 15 '15 at 16:47
  • The questions specific, but any answer would be very broad, since there's not a single package that replaced it. Maybe edit the question to only be about the parts you need? – user2699 Dec 15 '15 at 18:25

1 Answers1

2

This does seem odd - the link you gave says "Elib has been decommissioned as a separate package since its useful functions have long since been included in Emacs.", but Elib is the first Google result for "emacs doubly linked lists", and I couldn't find anything about them being in Emacs.

I guess the key word there is "useful", which is a bit subjective. But in all my novice lisp programming I've never needed doubly linked lists, and I've never seen any code that uses them.

So I'd say, just use Elib if you need a doubly linked list, and Elib works - it looks like a well documented library. The code is available here - https://github.com/burakbayramli/kod/tree/master/site-lisp/elib. It's interesting to see such an old library - copyright 1991-1995.

Brian Burns
  • 1,577
  • 14
  • 15
  • I assume not only Emacs, but GNU ELPA is meant as well when speaking of "included in Emacs". There is a dict-tree, heap, queue and trie available... – wasamasa Dec 15 '15 at 23:10
  • Interestingly though, even in Melpa there doesn't appear to be a doubly linked list or AVL tree package - I guess people haven't found a need for them in Emacs lisp, though it looks like there are libraries for them in Common Lisp. – Brian Burns Dec 15 '15 at 23:22
  • `avl-tree.el` is part of Emacs [since version 23.1](http://git.savannah.gnu.org/cgit/emacs.git/tree/etc/NEWS.23#n2528) – npostavs Dec 16 '15 at 02:35
  • . . . and there's that curious "cookie" thing at the (Utah) elib site, which describes "nodal data in a buffer." I'm guessing that was someone's idea of how to modularize elisp. I can't find anything further on it, though. It uses a ddl. . . But in general, I (and probably many others) are weak on data structures, possibly due to poor education (too much hand-waving, not enough thorough grounding and good, real-world examples) and being spoiled by cheap database availability. – 147pm Dec 16 '15 at 04:02
  • @npostavs Jeez, not sure how I missed that - thanks. – Brian Burns Dec 16 '15 at 05:21
  • @147pm Yeah the cookie thing is interesting - looks like maintaining a list of objects that can be printed nicely to a buffer - I like that you put them in a 'tin'. And this was a long time ago - "The internal functions don't contain any doc-strings. RMS thinks this is a good way to save space." – Brian Burns Dec 16 '15 at 05:21
  • 1
    @147pm: I think `ewoc` would be a builtin equivalent to that "cookie" thing (see also [a blog post comparing `ewoc` to `tabulated-list-mode` (yet another alternative)](http://mbork.pl/2015-07-18_TLM_vs_EWOC,_or_there_and_back_again)) – npostavs Dec 16 '15 at 15:59