Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Dangling Closing Parentheses vs. Stacked Closing Parentheses
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Duane Rettig  
View profile  
 More options Mar 28 2000, 3:00 am
Newsgroups: comp.lang.lisp
From: Duane Rettig <du...@franz.com>
Date: 2000/03/28
Subject: Re: Dangling Closing Parentheses vs. Stacked Closing Parentheses

Gareth McCaughan <Gareth.McCaug...@pobox.com> writes:
> 2. I like to be able to get a lot of code into a small
>    space; I can think about it much better that way.

> I know that you don't think #1 is worth bothering about;
> that's up to you. Let's look at #2.

> Compare the following two code fragments.

> (defun build-upward-closures ()
>   (loop for k from *maxplay* downto 0 do
>     (setf (aref *upward-closures* k)
>           (let ((result (ash 1 k)))
>             (loop for i from 0 below *n* do
>               (let ((k1 (logior k (ash 1 i))))
>                 (when (> k1 k)
>                   (setf result (logior result (aref *upward-closures* k1))))))
>             result))))

> and

> (defun build-upward-closures ()
>   (loop for k from *maxplay* downto 0 do
>     (setf (aref *upward-closures* k)
>           (let ((result (ash 1 k)))
>             (loop for i from 0 below *n* do
>               (let ((k1 (logior k (ash 1 i))))
>                 (when (> k1 k)
>                   (setf result (logior result (aref *upward-closures* k1)))
>                 )
>               )
>             )
>             result
>           )
>     )
>   )
> )

I've seen most of the style arguments based on philosophy posted
on this thread, but there is one argument I have not yet seen.
The most convincing argument for me to run with the first style is
what the lisp itself says:

user(1): (pprint '(defun build-upward-closures ()
  (loop for k from *maxplay* downto 0 do
    (setf (aref *upward-closures* k)
          (let ((result (ash 1 k)))
            (loop for i from 0 below *n* do
              (let ((k1 (logior k (ash 1 i))))
                (when (> k1 k)
                  (setf result (logior result (aref *upward-closures* k1)))
                )
              )
            )
            result
          )
    )
  )))

(defun build-upward-closures ()
  (loop for k from *maxplay* downto 0 do
        (setf (aref *upward-closures* k)
              (let ((result (ash 1 k)))
                (loop for i from 0 below *n* do
                      (let ((k1 (logior k (ash 1 i))))
                        (when (> k1 k)
                          (setf result
                                (logior result
                                        (aref *upward-closures* k1))))))
                result))))
user(2):

In general, any lisp code that can be manipulated as data is
easier to work with if it matches the result of its pretty-printed
output.  Now it is true that the pretty printer can be customized,
and thus you're not going to get exactly the same output if you
change, say, indentation rules and other attributes.  But for all of
its customizability, I know of no way to tell the pretty-printer to
dangle its closing parens.  Was this an oversight, or by design?

For Anthony Cartmell, I don't know IDL, and I've already posted
the opinion of an ICAD developer, but it seems to me that whether
or not IDL rules should allow for dangling parens should be weighed
heavily on whether or not a defpart is source-only, or whether it
is possible by any means to get hooks into the source (by way of
a code-walker, macroexpansion, or other debugging activity).  If
the former, then it doesn't matter.  If the latter, then unless
there have been extensions to ICAD's pretty-printer over CL's
printer, the intermediate forms will look "wrong", because they
will have no dangling parens.

--
Duane Rettig          Franz Inc.            http://www.franz.com/ (www)
1995 University Ave Suite 275  Berkeley, CA 94704
Phone: (510) 548-3600; FAX: (510) 548-8253   du...@Franz.COM (internet)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.