A set of rules I'm planning out, which would break with most lisp
conventions but preserve the essence of allowing redefinitions of
everything are:

1.  Symbols are of two types:

1.1.  Normally-prefix: /[A-Za-z_][A-Za-z0-9_]*/ or /[.][.]+/

1.2.  Normally-infix: /[+-*/\!@#$%^&:?<>~]+/

2.  Other datums as in typical Lisp.

3.  An out-of-line declaration indicates infix precedence levels and types
(well, at least out-of-line for "normal" datums).

4.  Backquotes "invert" the use of a symbol: foo is a prefix symbol, `foo`
is an infix symbol; while + is an infix symbol while `+` is a prefix symbol.

Processing proceeds as follows:

1.  Use "intuitive" parenthesis insertion based on indentation (in the
example below, the "." are just used to indicate indentation:

map f (a:as) =
. f a:map f as

=>

(map f (a : as) =
  (f a:map f as))


select b t f =
. if b
. . then t
. . else f

=>

(select b t f =
  (if b
    (then t)
    (else f)))

Handle $ SUBLIST at this stage too.

2.  Process infixes.  This involves converting infix forms to prefix forms
and handling precedence.  An infix symbol will cause () to be added to its
left and right hand sides, unless the left/right hand side is composed of
single datums; lower precedence is handled first. Example:

(1 + 2 * 3) => (`+` 1 (2 * 3)) => (`+` 1 (`*` 2 3))

(map f (a : as) = (f a : map f as))
=>
(`=` (map f (a : as)) (f a : map f as))
=>
(`=` (map f (a : as)) (`:` (f a) (map f as)))
=>
(`=` (map f (`:` a as)) (`:` (f a) (map f as)))

The final form is the one used internally, and is a Lisp.

Sincerely,
AmkG
------------------------------------------------------------------------------
_______________________________________________
Readable-discuss mailing list
Readable-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/readable-discuss

Reply via email to