On Sat, Feb 9, 2013 at 7:47 AM, Arne Babenhauserheide <arne_...@web.de> wrote: > 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) >
Really? Because your rule is: > - 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). So: (a b c d e f g h ) i j k ? > > And the problematic code switches to > > > concat "I want " > getwish from me > . " - " username You know, this second example suggests that maybe the "then it only closes the bracket" is incorrect. Here's a set that seems to be closer to what you want (ignoring ":" for now) - at the start of the read, the "previous line's indent" is considered as negative. - A line with the same indent as the previous line inserts a ")". It also inserts a "(" unless the line starts with "." - a line with a greater indent than the previous line inserts a "(" unless the line starts with "." - a line with a lesser indent than the previous line inserts a ")" for each indentation level popped, followed by a closing ")" - "." at the start of the line is removed. So: concat "I want" getwish from me . " - " username at the start of read, the previous line's indent is negative, so "concat" at indent 0 is more indented and inserts a "(": (concat "I want" ^ getwish from me . " - " username the next line is more indented than the previous line, so insert: (concat "I want" (getwish from me ^ . " - " username The next line has same indent, but also a ".", so insert only a ")": (concat "I want" (getwish from me ) " - " username ^ The next line is empty, which is an indent at 0, so pop off one indent (one ")") and add a closing ): (concat "I want" (getwish from me ) " - " username )) erk, that has an extra ")", ... or something anyway. Maybe "." should raise a flag that suppresses ")" for the next line. But I think that ends up having a stack in the case of indentation. ...or something, at least. Hehe. > > > 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 > > > ------------------------------------------------------------------------------ > 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 > ------------------------------------------------------------------------------ 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