unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: girosenth <girosenth@india.com>
To: help-gnu-emacs@gnu.org
Cc: girosenth@gmail.com, girosenth@india.com
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 14:50:52 -0800 (PST)	[thread overview]
Message-ID: <58e36af6-01b2-4e3c-ad92-4ab674c4831d@e20g2000vbn.googlegroups.com> (raw)
In-Reply-To: 87pqsgk8v9.fsf@kuiper.lan.informatimago.com

On Jan 1, 6:15 am, "Pascal J. Bourguignon" <p...@informatimago.com>
wrote:
> girosenth <girose...@india.com> writes:
> > How to improve the readability of (any) LISP or any highlevel
> > functional language to the level of FORTH ?
>
> > There are many people who have trivia complaints about parens in lisp,
> > but I dont.
>
> > LISP is a prefix notation.
>
> > sequence of operations would look like this on operands (ops) :
>
> > (f ops (g ops (h ops (j ops (k ops (l ops ))...))))
>
> > How do you make it readable ?
> > How do you home to the center or centers ?
>
> > (f (g (h (j (k (l ops)))...)))
>
> > is easy to read or
>
> > ops l k j h g f
>
> > ???
>
> I think we can call you a troll.

Factually, such a level of prejudice is not good for health, intellect
or discussion.

> Is it not obvious how you home to the center?http://www.informatimago.com/~pjb/bulleye.png
> Is it not a flagrant proof that lisp is the most easy to read?

There are things that I was hoping experienced programmers would fill
in that I forgot to state.

In a one liner which is an accurately represented by the subsets your
image displays, it is infact true that the center(s) are immediately
obvious. But if each of the f,g,h,...k,l are huge functions (in the
definitions) then they may occupy parts of a screen and the whole may
occupy several screens, or several tens of screens. Note also that I
have ops only before , but they can be everywhere. Function
(definition) enclosures have a 1-1 correspondence with trees as any
hierarchical objects and may look like a herringbone tree.

Sphagetti code which was promoted by a goto was brought under control
by "structured" programming which had only 3 forms (thus removing the
need for a flow chart) ie sequence, selection and iteration.
Functional language adds another useful form which is recursion and
(as a side comment) recursion is not representable by a flowchart.

The sequence, which is the simplest of the construct is essentially
imperative in nature. Sequence of state changes.

A purely functional program would have a single huge nested function.

One could say that a huge function can be broken into simpler
functions. Logic could always be chased LINE BY LINE by a determined
reader with unlimited time, but for most of us, programming efficiency
is an issue. However, to break a several screen or even a smaller set
of computation, I am faced with how to break it into parts due to
coupling in its parts. I was doing it inside let* to avoid setq
(fair ?) but I have a function that must return a number or a string
depending on if a regex was found and its index or a message that it
was not found.

(string-match REGEXP STRING &optional START)

inside a (cond) I return a string or the number

I am constrained to write like this because I wrote a quick and dirty
working and structurally (in the sense of structured) readable code
but WITHOUT taking care of failures or errors. Now I am trying to
modify it to take care of errors.

I must test it as soon as string match what type of regexp was not
found.

As I started modifying it, I lost track of its structure. I could
understand it at the write time but I know that after forgetting, at
the read time I will not understand it in the linear sense of the size
increase.

Even as I explained to a friend, I realized that I need to home in to
the center and reading was not linear as FORTH promises and any
postfix language with action words (functions) reads. The reading is
not linear.

I realized that you can read infix notation or standard function
notation f(x) of (f x) only because they are simpler functions, not
the recursive type functions of McCarthy. Those functions have if then
else logic embedded that is not apparent as you start reading it.

Our math functions are very simple, and most often single letters.
That is why algebraic notation is easy for them.

In comparison to prefix, postfix seems in the order of the action.
Certainly, it starts with the center object moved to the left most.

One gentleman has advocated ruby. The thread will be enriched by
perspectives from other functional languages. Suppose, I want to stick
to elisp and then move to CL (since almost everyone who has not taken
a course in lisp or scheme and who starts with linux comes to emacs
and elisp first) instead of ruby, then it appears to me that macros
which are being discussed without any examples in elisp or even CL
might be an answer to take care of sphagetti code or highly coupled
code. I was considering making a huge MIMO function that takes in many
bits and makes an output to be used by others. Atleast, the main
program would be readable. Such a function would have no analogy to
the real world object or operation and thus built on fictional lines
and unstable in construction and likely to be challenged by then next
exception that I would encounter in my build-fix method and thus beg
for recoding and re-reading again. Readability then is an issue.

I read your post somewhere with your example of flatten. I was
honestly not impressed with readability. All that you did was to
compress cond and also to use push/pop which would be indicated by a
text comment as clearly. Admitted that the code took smaller part of
the screen.

In modern IDE's there is a feature which allows code to be collapsed.
I am using older version of emacs I dont know if RMS and his team has
copied such features from eclipse and other IDEs into emacs and
debugged them or a bold adventurer would be on their mercy.

In the hygenic macro thread currently in progress, I want to ask them
to show me how macros can be written to prove their claims assuming
that I have good grasp of basics like quote, backquote, unquote and
splice.

I know some of these might sound unpleasant to commercial entities
with so much invested in it but for us, honest discussion and support
of claims by demonstration example is what really counts.

girosenth

> --
> __Pascal Bourguignon__                    http://www.informatimago.com/
> A bad day in () is better than a good day in {}.- Hide quoted text -
>
> - Show quoted text -



  parent reply	other threads:[~2011-01-01 22:50 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-01  7:04 How to improve the readability of (any) LISP or any highlevel functional language to the level of FORTH ? girosenth
2011-01-01 11:39 ` Elena
2011-01-01 14:15 ` Pascal J. Bourguignon
2011-01-01 16:08   ` Nathan
2011-01-01 18:05     ` Jan Burse
2011-01-01 23:56     ` The Quiet Center
2011-01-02  1:10       ` Jan Burse
2011-01-02  3:45       ` LanX
2011-01-02  4:04         ` LanX
2011-01-02  5:36           ` Nathan
2011-01-02  6:46             ` Paul Rubin
2011-01-02 15:01               ` LanX
2011-01-02 15:14                 ` Jerome Baum
2011-01-02 21:21                 ` Paul Rubin
2011-01-02  7:14             ` w_a_x_man
2011-01-02  6:59       ` w_a_x_man
2011-01-03 15:22         ` LanX
2011-01-02 14:07       ` Frank GOENNINGER
2011-01-07  9:41       ` w_a_x_man
2011-01-09 10:41         ` How to improve the readability of (any) LISP or any highlevelfunctional " WJ
2011-01-03 10:29     ` How to improve the readability of (any) LISP or any highlevel functional " Didier Verna
2011-01-03 13:05       ` Tim Harig
2011-01-04  4:49         ` rusi
2011-01-04  5:39           ` D Herring
2011-01-04  8:02             ` Tim Harig
2011-01-04  9:09               ` Nicolas Neuss
2011-01-04 10:00               ` Tim Bradshaw
2011-01-04 12:21                 ` Tim Harig
2011-01-04 12:23                   ` Tim Bradshaw
2011-01-04 13:33                     ` Tim Harig
2011-01-04 12:41                   ` Tamas K Papp
2011-01-04 23:32                 ` Tim X
2011-01-05  1:35                   ` [OT] LISP community advocacy [was Re: How to improve the readability of (any) LISP or any highlevel functional language to the level of FORTH ?] Tim Harig
2011-01-05  9:52                   ` How to improve the readability of (any) LISP or any highlevel functional language to the level of FORTH ? Tim Bradshaw
2011-01-04  6:24           ` Pascal J. Bourguignon
2011-01-04 15:43             ` Raffael Cavallaro
2011-01-04 10:18         ` Didier Verna
2011-01-01 22:50   ` girosenth [this message]
2011-01-02 21:11     ` Thien-Thi Nguyen
2011-01-03 16:21     ` José A. Romero L.
2011-01-03 18:03     ` jacko
2011-01-02 23:45   ` Chip Eastham
2011-01-01 18:27 ` How to improve the readability of Steve Revilak
2011-01-01 19:22 ` How to improve the readability of (any) LISP or any highlevel functional language to the level of FORTH ? prad
2011-01-01 23:56 ` Pascal Costanza
2011-01-02  5:39   ` D Herring
2011-01-02 14:17     ` Frank GOENNINGER
2011-01-02 14:53       ` Jerome Baum
2011-01-02 14:58         ` LanX
2011-01-02 17:55     ` Bernd Paysan
2011-01-03 18:07   ` jacko
2011-01-02 12:59 ` Doug Hoffman
2011-01-02 19:14   ` w_a_x_man
2011-01-03  5:20     ` Elizabeth D Rather
2011-01-03 10:48     ` MarkWills
2011-01-03 15:13       ` LanX
2011-01-03 18:20     ` jacko
2011-01-03 18:22     ` jacko
2011-01-03 10:18 ` Didier Verna
2011-01-04  6:47 ` pineapple
2011-01-04 14:14   ` P.M.Lawrence
2011-01-05 14:58 ` Xah Lee
2011-01-05 16:21   ` Andrew Haley
2011-01-05 21:29     ` Pascal J. Bourguignon
2011-01-06  8:57       ` Jonathan Groll
2011-01-07  5:36     ` Xah Lee
2011-01-07 13:28       ` Andrew Haley
2011-01-07 16:19         ` Xah Lee
2011-01-05 17:59   ` Elena
2011-01-05 20:13     ` Xah Lee
2011-01-05 21:42     ` Pascal J. Bourguignon
2011-01-06 13:38       ` Doug Hoffman
2011-01-06 19:20         ` Pascal J. Bourguignon
2011-01-07  0:09           ` w_a_x_man
2011-01-07 12:04           ` Doug Hoffman
2011-01-06 22:59   ` Xah Lee
2011-01-07 11:47     ` Jan Burse
2011-01-21 10:03       ` rupertlssmith
2011-01-21 16:08         ` Jan Burse
2011-01-21 21:43           ` D. J. Penton
2011-01-18 22:55 ` m_l_g3
2011-01-19 13:45   ` Doug Hoffman
2011-01-21 16:15   ` Jan Burse
  -- strict thread matches above, loose matches on Subject: below --
2011-01-02 16:50 Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=58e36af6-01b2-4e3c-ad92-4ab674c4831d@e20g2000vbn.googlegroups.com \
    --to=girosenth@india.com \
    --cc=girosenth@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).