gnu-arch-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnu-arch-users] Re: Tla spork


From: Tobias C. Rittweiler
Subject: Re: [Gnu-arch-users] Re: Tla spork
Date: Fri, 27 Aug 2004 19:47:19 +0200

On Friday, August 27, 2004 at 5:02:40 PM, 
    John Meinel <address@hidden> wrote:

John,

I'll take this opportunity to beg you *not* to place your reply on top
of the fully or partly quoted original text, as it'll make your eMail
more difficult to read. For more, conrete rationale please see
http://learn.to/quote.


> One of the biggest problems with the lisp syntax is that if I want to
> add a new term without changing priority I have to add a character at
> both the beginning and end of the statement (+ ..... d), and mentally it
> separates the operation from the thing it is operating on. For instance
>
> (+ (+ a b) (- (c (/ (*d (* e f)) (* g (+ n 1)))
> Versus
> a + b + c - (d * e * f) / (g * (n + 1))

As others pointed out, those functions are of variable arity.
I want to add that the indentation buys you much; usually you indent
lisp code from left to right so that you can easily spot where something
belongs to, like this:

  (func1 (func2 arg1 arg2)
         (func3 arg3 arg4)
         (func4 arg5
                (func5 arg 6)))

For instance, once I had to write a silly chess program for school and I
needed to write a two or three line statement of conditionals (`and's
and `or's). I couldn't do that with Pascal (I even wrote what I
needed down as scheme expressions initially and tried to transform that
to pascal manually, but got stuck.) It's much easier to write `and' once
at the left and everything that should be `and'ed linewise to the right,
than having to repeat an `and' as infix operator all the time. YMMV.

[And here yet again a nifty way how to think of long concatened
 expressions, which you regularly encounter when doing functional
 programming:

   Let's say we have the following:

   (func1 arg1
          arg2
          (func2 arg3
                 (func3 arg4)))

  You can think of this as something like a long line of shell commandos
  piped together:

    func3 arg4 | func2 arg3 | func1 arg1 arg2

  As you see the order is reversed, that's why you mostly begin to read
  the expression on the most far right side.]



> I would also *like* to have more than just parenthesis for separation.

For instance, PLT Scheme just offers that.

> I do think the first version *looks* prettier. But it's hard for me to
> count the final number of parenthesis, and I certainly have no idea
> which one goes with what, without doing a lot of parenthesis counting.

You never ever have to count the parens! Here's another tip: Ignore
almost all parens! Assume that the number of them is right (and Good
Editors should be able to mark if there seems to be something wrong with
them)

[And incidentally, here's one of Asuffield's point: Why are thoses
parentheses there even though I should ignore most of them anyway?
That's something the machine should figure for me!]


-- tcr (address@hidden)  ``Ho chresim'eidos uch ho poll'eidos sophos''





reply via email to

[Prev in Thread] Current Thread [Next in Thread]