🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.functional
Article #1146

Re: How to improve the readability of (any) LISP or any highlevel functional language to the level of FORTH ?

#1146
From: Doug Hoffman
Date: Wed, 19 Jan 2011 13:45
54 lines
3025 bytes
On 1/18/11 5:55 PM, m_l_g3 wrote:
> On Jan 1, 10:04 am, girosenth<girose...@india.com>  wrote:
>> How to improve the readability of (any) LISP or any highlevel
>> functional language to the level of FORTH ?
>
> ...
>>
>> How do you make it readable ?
> ...
>>
>> (f (g (h (j (k (l ops)))...)))
>
> (e
>     (f
>        (g (h i)
>           (j k l)
>        )
>        (m (n o (p q))
>           (r (s t) u)
> )  )  )
>
> The rule: if you don't see the closing paren moving the eyes down,
> it's on the right.
> But it either to the right or down, no other option.

I would assume that Lispers would use a source editor that automatically 
hilights corresponding parens (e.g., selct a left paren and the right 
paren becomes bold or whatever) and checks for missing parens 
automatically before compilation is attempted.


> As to Forth, you may try to layout control structures on the right,
> as if RPN is not enough:
>
> : MAX   2dup>       if
>              drop    else
>              nip     then
> ;

I agree with vusual "aligning" for control words.  But I would do it 
differently (stack comment please!).  The above suggests to me that ELSE 
is consuming the result of the DROP and THEN is consuming the result of 
the NIP.

Better, IMHO:

: MAX ( n1 n2 -- max )
   2dup > IF   drop
          ELSE nip
          THEN ;

Read in English as " <condition> iftrue DROP, otherwise NIP, then continue".

-Doug
Technical Details
Message-ID: <4d36eb02$0$23753$14726298@news.sunsite.dk>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!goblin3!goblin2!goblin1!goblin.stu.neva.ru!news.astraweb.com!border3.a.newsrouter.astraweb.com!newsfeed101.telia.com!starscream.dk.telia.net!news.tele.dk!feed118.news.tele.dk!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail
References: <80ceeca0-1d32-47d1-ba96-feb4d9729c3a@v17g2000yqv.googlegroups.com> <5121f8b1-a8d2-4587-a45e-387469762668@m13g2000yqb.googlegroups.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: ee3de009bc,1641de092071599d
X-Google-Attributes: gidee3de009bc,public,usenet
X-Google-NewGroupId: yes
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!goblin3!goblin2!goblin1!goblin.stu.neva.ru!news.astraweb.com!border3.a.newsrouter.astraweb.com!newsfeed101.telia.com!starscream.dk.telia.net!news.tele.dk!feed118.news.tele.dk!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail
Date: Wed, 19 Jan 2011 08:45:37 -0500
From: Doug Hoffman <glidedog@gmail.com>
Reply-To: glidedog@gmail.com
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.5; en-US; rv:1.9.2.8) Gecko/20100802 Lightning/1.0b2 Thunderbird/3.1.2
MIME-Version: 1.0
Newsgroups: comp.lang.functional,comp.lang.lisp,gnu.emacs.help,comp.lang.forth,comp.lang.prolog
Subject: Re: How to improve the readability of (any) LISP or any highlevel
 functional language to the level of FORTH ?
References: <80ceeca0-1d32-47d1-ba96-feb4d9729c3a@v17g2000yqv.googlegroups.com> <5121f8b1-a8d2-4587-a45e-387469762668@m13g2000yqb.googlegroups.com>
In-Reply-To: <5121f8b1-a8d2-4587-a45e-387469762668@m13g2000yqb.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 54
Message-ID: <4d36eb02$0$23753$14726298@news.sunsite.dk>
Organization: SunSITE.dk - Supporting Open source
NNTP-Posting-Host: 76.112.56.146
X-Trace: news.sunsite.dk DXC=Hbcn39O_;iPKP<Ea^JV7o]YSB=nbEKnk[=Wf0P_7c\ZV:je<aU]h2SRF8_<o2?^;\^Ie5nH2<[g6Pj<AL2Y=VFAR9[XP_f0ON2Y
X-Complaints-To: staff@sunsite.dk