On Fri, Nov 14, 2008 at 7:14 AM, David A. Wheeler <[EMAIL PROTECTED]>wrote:

> Alan Manuel Gloria asked: > > How about the cond-style if of Arc? > > (if > > (condition1) > > (dothis1) > > (condition2) > > (dothis2) > > (default)) > ... > > if > > (condition1) > > -> (dothis1) > > (condition2) > > -> (dothis2) > > -> (default) > > I presume the intent is that "->" at the beginning > of a line is ignored. Is that what you mean?? > I'll comment based on that possibly wrong assumption, > please correct me if that wasn't intended. > > That _looks_ nice, but two issues: > 1. That rule would make "->" unusable, which in many apps is really > important. > A less-common symbol could work, though, such as "\ ". True. \ does look nice. - Show quoted text - > > 2. For short pairs that's really awkward. You still have to use 2 lines > to provide information that in traditional Lisp notation only requires > one line. For attribute-value pairs that's really important. > > For example, given the SMT-LIB example: > (benchmark bignum > :source "SMT-COMP'06 Organizers" > :notes "This benchmark is designed to check if the DP supports > bignumbers." > :status sat > :difficulty "0" > :category "check" > :logic QF_RDL > :extrafuns ((x1 Real)) > :extrafuns ((x2 Real)) > :extrafuns ((x3 Real)) > :extrafuns ((x4 Real)) > :formula > (and (<= (- x1 x2) (/ 1 1000000000000000000000000000000000)) > (<= (- x2 x3) (/ 1 2000000000000000000000000000000011)) > (<= (- x3 x4) (~ (/ 1 1000000000000000000000000000000000))) > (<= (- x4 x1) (~ (/ 1 2000000000000000000000000000000012))))) > > > The simple rule "-> ignored at beginning of line" could be used, but that > would produce: > benchmark bignum > :source > -> "SMT-COMP'06 Organizers" > :notes > -> "This benchmark is designed to check if the DP supports bignumbers." > :status > -> sat > :difficulty > -> "0" > :category > -> "check" > :logic > -> QF_RDL > :extrafuns > -> ((x1 Real)) > :extrafuns > -> ((x2 Real)) > :extrafuns > -> ((x3 Real)) > :extrafuns > -> ((x4 Real)) > :formula > -> and { {x1 - x2} <= {1 / 1000000000000000000000000000000000} } > { {x2 - x3} <= {1 / 2000000000000000000000000000000011} } > { {x3 - x4} <= ~({1 / 1000000000000000000000000000000000}) } > { {x4 - x1} <= ~({1 / 2000000000000000000000000000000012})} > ) > > Yuk. Vertical space is precious; most screens have less vertical than > horizontal space. > > I think we must NOT use "->" as the symbol, anyway. > So how about "\ " (backslash followed by space) > as the special symbol? That's rather improbable outside a > string element; how many times do you need a symbol beginning > with space or newline? > > So here's another rule idea, inspired by that approach. > When doing indentation processing: > 1. A "\ " at the beginning of the line (after whitespace) is ignored > (recursively, so you can have several if you want them). > 2. INSIDE a line, "\ " means "treat this as a line break, > with the next line beginning at this same indentation level". > 3. At the END of a line, "\" means "ignore the newline"; it > basically merges the line with the next one & ignores indentation. > > If we do that, we can write: > > ; When condition1, dothis1, etc. are lengthy, you can do this: > if > (condition1) > \ (dothis1) > (condition2) > \ (dothis2) > (default) > > ; When condition1, dothis1, etc. are short, you can do this: > if > (condition1) \ (dothis1) > (condition2) \ (dothis2) > (default) > > benchmark bignum > :source \ "SMT-COMP'06 Organizers" > :notes \ "This benchmark is designed to check if the DP supports > bignumbers." > :status \ sat > :difficulty \ "0" > :category \ "check" > :logic \ QF_RDL > :extrafuns \ ((x1 Real)) > :extrafuns \ ((x2 Real)) > :extrafuns \ ((x3 Real)) > :extrafuns \ ((x4 Real)) > :formula > \ and { {x1 - x2} <= {1 / 1000000000000000000000000000000000} } > { {x2 - x3} <= {1 / 2000000000000000000000000000000011} } > { {x3 - x4} <= ~({1 / 1000000000000000000000000000000000}) } > { {x4 - x1} <= ~({1 / 2000000000000000000000000000000012})} ) > > ; or alternatively: > benchmark bignum \ > :source "SMT-COMP'06 Organizers" \ > :notes "This benchmark is designed to check if the DP supports > bignumbers." \ > :status sat \ > :difficulty "0" \ > :category "check" \ > :logic QF_RDL \ > :extrafuns ((x1 Real)) \ > :extrafuns ((x2 Real)) \ > :extrafuns ((x3 Real)) \ > :extrafuns ((x4 Real)) \ > :formula \ > and { {x1 - x2} <= {1 / 1000000000000000000000000000000000} } > { {x2 - x3} <= {1 / 2000000000000000000000000000000011} } > { {x3 - x4} <= ~({1 / 1000000000000000000000000000000000}) } > { {x4 - x1} <= ~({1 / 2000000000000000000000000000000012})} ) > > ; If you reorder the ":formula" entry you can see why just the "\ at the > end" > ; doesn't completely solve the problem. You can't really do that here: > benchmark bignum > :logic \ QF_RDL > :formula > \ and { {x1 - x2} <= {1 / 1000000000000000000000000000000000} } > { {x2 - x3} <= {1 / 2000000000000000000000000000000011} } > { {x3 - x4} <= ~({1 / 1000000000000000000000000000000000}) } > { {x4 - x1} <= ~({1 / 2000000000000000000000000000000012})} ) > :source \ "SMT-COMP'06 Organizers" > :notes \ "This benchmark is designed to check if the DP supports > bignumbers." > :status \ sat > :difficulty \ "0" > :category \ "check" > :extrafuns \ ((x1 Real)) > :extrafuns \ ((x2 Real)) > :extrafuns \ ((x3 Real)) > :extrafuns \ ((x4 Real)) > > Hmm, this rule doesn't seem too bad. It's relatively > simple, and _seems_ useful. I _could_ be convinced. > Thoughts? > Hmm. if aprim ast \ expand-prim ast acond ast \ expand-cond ast \ do zap [map expansion _] ast!subx ast Not bad. Sincerely, AmkG

------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/

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