🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #49

collapsing lists to tree

#49
From: Paul Singleton
Date: Tue, 03 Nov 1992 15:31
23 lines
1082 bytes
I wish to collapse a list of lists into a tree by recursively factoring
out common initial elements, e.g.

    [ [ a, b, l, e],
      [ a, b, o],
      [ a, b, o, r, t],
      ...

into

  - a - b - l - e - []
          \
            o - []
              \
                r - t - []

Is there an established name for this latter data structure?  Is there
published code for creating it?
----
  __   __    Paul Singleton (Mr)           JANET: paul@uk.ac.keele.cs
 |__) (__    Computer Science Dept.        other: paul@cs.keele.ac.uk
 |  .  __).  Keele University, Newcastle,    tel: +44 (0)782 621111 x7355
             Staffs ST5 5BG, ENGLAND         fax: +44 (0)782 713082
Technical Details
Message-ID: <Bx5CFy.I6F@gabriel.keele.ac.uk>
Path: arc1-ca.pugleaf.net!sparky!uunet!pipex!unipalm!uknet!keele!csa09

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!pipex!unipalm!uknet!keele!csa09
From: csa09@keele.ac.uk (Paul Singleton)
Newsgroups: comp.lang.prolog
Subject: collapsing lists to tree
Message-ID: <Bx5CFy.I6F@gabriel.keele.ac.uk>
Date: 3 Nov 92 15:31:09 GMT
Sender: news@gabriel.keele.ac.uk (UseNet News Service)
Organization: Keele University, England
Lines: 23
Nntp-Posting-Host: seq1.cc.keele.ac.uk