Re: Lisp indenting tool



Rainer Joswig wrote:
But Common Lisp has that. The function is called PPRINT.
It is based on a huge machinery defined in ANSI Common Lisp.

Jeremy Smith wrote:
This looks like a good indenting solution. The only problem is that it
doesn't seem to keep comments, which is a problem on a big source file.

Maybe there would be some way to keep comments after pretty-printing the
source, by re-inserting them afterwards.

Good point.

From my experience with Mathematica, this is not possible when the
solution is based on the compiler taking source code as input (since
it discards comments).

Maybe CL has a way to tell the compiler to keep the comments...

If some lisper writes a simple parser in elisp, that'd be great.
This'll solve problems in Common/Scheme/Emacs lisps. I just want this
to work in emacs lisp.

------------------------------

(Mathematica has this build-in, so that when you press a keyboard
shortcut, it reformats your code in any one of the predefined ways,
namely InputForm (plain source text), StandardForm (displaying it as
typeset 2D math), TraditionalForm (like StandardForm, but follows
traditional math notation much like LaTeX's default) (you can write
code to process whole source code exactly like lisp because of the
“source = data” property, and this is done practically often. One
example is a transparent built-in converter for opening older
Mathematica notebooks (i.e. the source code file) in a newer
Mathematica version. (it reads the source code, add extra info or
structure for the newer Mathematica version if necessary (such as
adding a version declaration), then display it in the “word-processor
like” integrated editor)))

------------------------------

Btw, i've always thougth that lisp's notation are not as regular as
Mathematica. For example, there's the “'(1 2 3)”. But that is
syntactically the same as “(quote (1 2 3))”, so it doesn't count as a
exception. But i think there are few others involving other chars like
“#”, “,”, but i'm not sure which of these are just syntax sugars and
which are genuine exception to the nested paren syntax.

My question is, could anyone list all these, and show exactly which
are just syntax equivalent on top of sexp and which are true
exceptions?

Xah
xah@xxxxxxxxxx
http://xahlee.org/



.



Relevant Pages

  • Re: Cons cell archaic!?
    ... naming in Mathematica, as Stephen Wolfram indicated in his blog ... early lisps to Common Lisp, there was a strong desire to allow old ... GIven a list of search strings, and one test string, ...
    (comp.lang.lisp)
  • Re: Maple Vs Mathematica
    ... in Maple one can list the source code for most of the ... In Mathematica the source code is not available to look ... LaplaceTransform. ...
    (sci.math.symbolic)
  • Re: Integer with base preserved!
    ... | To be able to operate upon source code at the list level requires the ... Common Lisp is not defined on the character strings that make up the ... character sequence that made up the document. ... Why involve the whole world in your imagination in a negative way like ...
    (comp.lang.lisp)
  • Re: Maple Vs Mathematica
    ... > There is one advantage to Maple over Mathematica (if this is important ... In Mathematica the source code is not available to look at. ... packages, Graph theory, combinatorics, most of the number theory etc ...
    (sci.math.symbolic)
  • Re: Static/Strong/Implicit Typing
    ... > Then I can't use the sequence functions of Common Lisp that ... > accept both lists and vectors. ... calls to the appropriate ones (since it has all the static type information ... > you define a function that operates on source code. ...
    (comp.lang.lisp)