🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #4106

Re: A Challenge

#4106
From: Mark Johnson
Date: Fri, 15 Dec 1989 15:41
19 lines
937 bytes
/* good(List1,List2, ... Listn) is true iff List1 ... Listn
 * are all of the same length
 */

good(Lists) :-
	all_null(Lists).
good(OldLists) :-
	minus_firsts(OldLists, NewLists),
	good(NewLists).

/* all_null(List) is true iff every element of List is [] */

all_null([]).
all_null([[]|Rest]) :- all_null(Rest).

/* minus_firsts([[_|List1], ... [_|Listn]], [List1, ..., Listn]) */
minus_firsts([], []).
minus_firsts([[_|List]|OldLists], [List|NewLists]) :-
	remove_firsts(OldLists, NewLists).
Technical Details
Message-ID: <23028@brunix.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!brunix!mj
References: <11500022@hpldoda.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!brunix!mj
From: mj@cs.brown.edu (Mark Johnson)
Newsgroups: comp.lang.prolog
Subject: Re: A Challenge
Message-ID: <23028@brunix.UUCP>
Date: 15 Dec 89 15:41:30 GMT
References: <11500022@hpldoda.UUCP>
Sender: news@brunix.UUCP
Reply-To: mj@cs.brown.edu (Mark Johnson)
Organization: Brown University Department of Computer Science
Lines: 19