A pair of lists

Pondering the philosophy behind the language

A pair of lists

Postby saulgoode » Mon Apr 29, 2013 4:21 am

I am writing a tutorial on developing a Scheme compiler and one of the data structures I am using is a pair of lists, where the car of the pair is a list of the symbols and the cdr of the pair is a list of their values.

For example, an a-list of the data might be '((a . 10) (b . 20) (c . 30))
And the p-list version would be '((a 10) (b 20) (c 30))
My data structure would be '((a b c) 10 20 30)

I am wondering if there is a common name for such a data structure (along the lines of a-list and p-list). If not, I would be open to suggestions on how I should refer to it.
saulgoode
 
Posts: 10
Joined: Sat Jul 16, 2011 6:15 am

Re: A pair of lists

Postby cormullion » Mon Apr 29, 2013 8:04 am

Do you mean '((a b c) (10 20 30))? Perhaps an 'indexed list'?

You might try asking on comp.lang.lisp. They have opinions to spare.

Just don't call it an iList. That's probably trademarked ...
cormullion
 
Posts: 2037
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W

Re: A pair of lists

Postby saulgoode » Mon Apr 29, 2013 11:38 am

cormullion wrote:Do you mean '((a b c) (10 20 30))?


Functionally the pair of lists would be equivalent to '((abc) . (10 20 30)) but when printed, the dotted notation gets removed such that the items in the second list directly follow the first list.

"Indexed list" would still seem a fairly apt term.
saulgoode
 
Posts: 10
Joined: Sat Jul 16, 2011 6:15 am

Re: A pair of lists

Postby Lutz » Tue Apr 30, 2013 11:21 am

The term pair of lists makes sense to me and relates to your p-list using the transpose function:

Code: Select all
(transpose '((a b c) (10 20 30)))  --> ((a 10) (b 20) (c 30))


Ps: there are new in-progress Windows binaries and source available at:
http://www.newlisp.org/downloads/develo ... nprogress/
with multiple times speed-up in unlimited precision integer division.
Lutz
 
Posts: 5261
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Re: A pair of lists

Postby rickyboy » Tue Apr 30, 2013 1:51 pm

Lutz wrote:Ps: there are new in-progress Windows binaries and source available at:
http://www.newlisp.org/downloads/develo ... nprogress/
with multiple times speed-up in unlimited precision integer division.

You da best, Lutz. Thanks!
(λx. x x) (λx. x x)
rickyboy
 
Posts: 557
Joined: Fri Apr 08, 2005 7:13 pm
Location: Front Royal, Virginia


Return to Whither newLISP?

Who is online

Users browsing this forum: No registered users and 1 guest