🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #2453

Grotesque

#2453
From: Olivier Ridoux
Date: Fri, 08 Jan 1993 09:04
24 lines
1009 bytes
> I realised a while back that you can use DCGs for many programs that
> don't look like parsing.  My favorite (and most grotesque) is flatten:
> 
> flatten(List, FlattenedList):-
>         phrase(flatten(List), FlattenedList).
> 
> flatten([]) --> [].
> 
> flatten([Head|Rest]) -->
>         flatten(Head),
>         flatten(Rest).
> 
> flatten(List) -->
>         [List].

I cannot see what is so *grotesque* in trying to give a condensed
expression of the regularities a computation contains.  

I suppose you disapprove of using DCG for something which seems the
opposite of syntactic analysis.  However, especially in Prolog, one
should be used with non-directional thinking.

Olivier Ridoux
Technical Details
Message-ID: <1993Jan8.090450.8875@irisa.fr>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!julienas!irisa!ridoux

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.prolog
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!julienas!irisa!ridoux
From: ridoux@irisa.fr (Olivier Ridoux)
Subject: Grotesque
Message-ID: <1993Jan8.090450.8875@irisa.fr>
Sender: news@irisa.fr
Organization: IRISA, Rennes (Fr)
Date: Fri, 8 Jan 93 09:04:50 GMT
Lines: 25