🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.functional
Article #1187

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

#1187
From: The Quiet Center
Date: Sat, 01 Jan 2011 23:56
70 lines
3941 bytes
On Jan 1, 11:08 am, Nathan <nbeen...@gmail.com> wrote:
> If you want a easy to read self-documenting functional language, look
> into Ruby. I know personally that Ruby syntax was a big turn off to me
> for several weeks (kind of like Lisp) but once you learn it, it
> becomes the easiest to read of any programming language I've ever
> experimented with. No contest.
>

Well, Python was chosen over Ruby for MIT's rework of their intro to
cs course because Python is multi-paradigm, whereas Ruby claims
everything is an object.

How would you code this simple list compression problem in Ruby:

1.08 (**) Eliminate consecutive duplicates of list elements.
    If a list contains repeated elements they should be replaced with
a single copy of the element. The order of the elements should not be
changed.

    Example:
    ?- compress([a,a,a,a,b,c,c,a,a,d,e,e,e,e],X).
    X = [a,b,c,a,d,e]

> Matz himself admitted that “...Ruby is a bad rip-off of Lisp... But it
> is nicer to ordinary people.”

yeah I guess the LOOP macro is where I got stuck in doing Lisp.

>
> Though every language I've worked in, I've never been half as
> productive as when I'm coding in Ruby.

I've done Perl at corporate level for 10 years and I've heard seasoned
Perl developers say the same thing.


>
> In particular, cross platform GUI application
> development seemed poor.

yeah, wxPython is the only thing for any scripting languages that
seemed to make very professional desktop UI programs.

>
> If you want to develop webpages, or bang out quick one time scripts,
> Ruby is hard to beat. For use at home, console applications are
> probably a tolerable price to pay for the incredible development speed
> and fantastic ease of maintenance Ruby will give your code.

yeah sinatra.rb looks nice for web dev and ruby on rails was a runaway
hit for awhile.

By the way, here's the Prolog solution to the compression problem I
posted earlier:



% http://sites.google.com/site/prologsite/prolog-problems/1

% Problem 1.08 - compress consecutive duplicates into a single
% list element

compress([], []).
compress([X,Y], [X,Y]) :- X \= Y.
compress([X,Y], [X])   :- X  = Y.

% problems writing other clauses (thanks RLa)

compress([X,Y|Z], [X|Z1])   :- X \= Y, compress([Y|Z], Z1).
compress([X,Y|Z], Z1)       :- X  = Y, compress([Y|Z], Z1).
Technical Details
Message-ID: <9e7a7683-a92a-4e88-a6f1-9e6a6bd2f057@z9g2000yqz.googlegroups.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!postnews.google.com!z9g2000yqz.googlegroups.com!not-for-mail
References: <80ceeca0-1d32-47d1-ba96-feb4d9729c3a@v17g2000yqv.googlegroups.com> <87pqsgk8v9.fsf@kuiper.lan.informatimago.com> <ca15d8c3-86db-46fd-b35f-1a2596475769@n32g2000pre.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,CP1252
Path: arc1-ca.pugleaf.net!g2news2.google.com!postnews.google.com!z9g2000yqz.googlegroups.com!not-for-mail
From: The Quiet Center <thequietcenter@gmail.com>
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 ?
Date: Sat, 1 Jan 2011 15:56:05 -0800 (PST)
Organization: http://groups.google.com
Lines: 71
Message-ID: <9e7a7683-a92a-4e88-a6f1-9e6a6bd2f057@z9g2000yqz.googlegroups.com>
References: <80ceeca0-1d32-47d1-ba96-feb4d9729c3a@v17g2000yqv.googlegroups.com>
 <87pqsgk8v9.fsf@kuiper.lan.informatimago.com> <ca15d8c3-86db-46fd-b35f-1a2596475769@n32g2000pre.googlegroups.com>
NNTP-Posting-Host: 76.108.76.117
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1293926165 7243 127.0.0.1 (1 Jan 2011 23:56:05 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Sat, 1 Jan 2011 23:56:05 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: z9g2000yqz.googlegroups.com; posting-host=76.108.76.117; posting-account=CLTRiQoAAAATysyZI2zRzNDqH657kxk9
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13)
 Gecko/20101206 Ubuntu/10.04 (lucid) Firefox/3.6.13,gzip(gfe)