Hi,

You might have noticed that after initial excitement I drew back from readable 
again. The reasons were partly time problems, but mostly that I have the 
feeling that readable currently moves into a direction which does not feel 
right to me.

There is now indentation based syntax (great!) with special casing for sublists 
(useful for nested functions), restart lists (hm) and now <* ... *> (looks 
alien).


To me this lost the beauty of lisp, that you have few fixed syntax rules which 
become second nature. Instead we now have mixed metaphors and code which can be 
written in a multitude of ways - which goes counter to readability (it’s not 
about every special case being beautiful, but having a consistent style which 
is nicely readable in most cases).


And it just felt wrong to see more and more special cases being added. That 
smelled of a problem in the basic concept.


Also I wondered how code like the following would be represented:

    (concat "I want " (getwish from me) " - " username)

Currently I only see this option:

    concat "I want " getwish(from me) " - " username

But not this

    concat "I want "
           getwish from me
           " - " username


I did not get my mind off the idea, though (and did not want to), and I derived 
a simpler concept from it:

- if a line starts with a . it is a continuation of the parent line
  (the last line which had lower indentation).
- if a line is further indented than the previous line,
  it opens a new bracket (except if it starts with a .),
- if it is indented equally, then it closes a bracket and opens a new one
  (except if it starts with a ., then it only closes a bracket).
- A : sourrounded by whitespace defines a new indentation level
  (similar to restart list, but more general).

That provides 4 clear rules, one of which is similar to an existing rule
( “(. a) → a” becomes “(. a b c) → a b c” ). And that’s all the syntax to learn 
with no special cases.


Essentially all it does is giving up the rule that a variable on its own is a 
variable instead of a function call.


By prefixing all variables with “.”, it also gets line continuations for free:

    a b c d e
      . f g h
      . i j k

is equivalent to

    (a b c d e
       f g h
       i j k)


And the problematic code switches to


    concat "I want "
           getwish from me
           . " - " username


Some of the Examples¹ from the sf.net site look like this (also using curly 
infix, since that’s useful for easier math):


   define : fibfast n
          if {n < 2}
          . n
          fibup n 2 1 0

    define : fibup maxnum count n-1 n-2
           if {maxnum = count}
             {n-1 + n-2}
             fibup maxnum {count + 1} {n-1 + n-2} n-1

    define : factorial n
           if {n <= 1}
           . 1
           {n * factorial{n - 1}}

    define : gcd x y
           if {y = 0}
           . x
           gcd y : rem x y



    define : add-if-all-numbers lst
           call/cc
             lambda : exit
                    let loop
                      :
                        lst lst
                        sum 0
                      if : null? lst
                         . sum
                         if : not : number? : car lst
                            exit #f)
                            + : car lst
                              loop : cdr lst



I wrote this to question if all those special cases (\\, $, <*…*>) are really 
the sign of an elegant solution - or not rather the hairy bits grown by 
limitations of the base design.

And to ask you to have a look at the simpler proposal and see whether I 
overlooked some problems.

I wrote it now (late at night) even though the idea has spooked my mind for the 
past few weeks, because I saw the idea to go SRFI now, so I feared that the 
limited base design (IMHO) could become set in stone and limit all further work 
which could be done to make lisp more readable.

Best wishes,
Arne

¹: http://sourceforge.net/p/readable/wiki/Examples/

--
Ein Würfel System - einfach saubere Regeln:

- http://1w6.org

Attachment: signature.asc
Description: This is a digitally signed message part.

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Readable-discuss mailing list
Readable-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/readable-discuss

Reply via email to