Subject: OPFR [was: Re: Road to Clojure...]
From: rpw3@rpw3.org (Rob Warnock)
Date: Sun, 15 Feb 2009 04:21:49 -0600
Newsgroups: comp.lang.lisp
Message-ID: <N7Sdndz4CMggcQrUnZ2dnUVZ_qfinZ2d@speakeasy.net>
Marco Antoniotti  <marcoxa@gmail.com> wrote:
+---------------
| Madhu <enom...@meer.net> wrote:
| > (Rob Warnock) <k5GdnQM7O_aa6grUnZ2dnUVZ_j2dn...@speakeasy.net> wrote:
| > | Then there was a whole thread in late 2007 on ARRAY-IOTA.
| >
| > Which reminds me to ask: could you consider and releasing OPFR?
| 
| Wow.  I *am* getting old.  What is a OPFR?
+---------------

"OPFR" == "Outer-Parenthesis-Free REPL". It's a meme/pattern/library(?)
that I've been talking about & using since early 1995 [if not earlier!],
first in Scheme, then in Common Lisp. The idea is simplicity itself:
a command-line reader that wrap a set of parens around whatever the user
types and then passes that to EVAL [with some minor tweaks so the most
common cases "do the right thing"]. The "rationale" comment from the
current CL version [soon to be public]:

    ;;; OPFR provides a simple command-line read-eval-print loop (REPL) for
    ;;; programs written in Common Lisp where the primary user community
    ;;; is uncomfortable using normal Lisp symbolic expressions (sexps).
    ;;; The simplicity and utility of OPFR derives from the observation
    ;;; that most such people are actually surprisingly accepting of an
    ;;; sexp-based interface *provided* that they are not required
    ;;; to manually type the outer pair of parentheses, *even if* any
    ;;; sub-expressions are still in pure Lisp sexp form!! This effect
    ;;; is even stronger when the majority of the command functions in the
    ;;; using application are provided as functions or macros, which only
    ;;; seldom require the typing of sub-expressions.
    ;;;
    ;;; This short example compares the syntaxes. First, normal Common Lisp:
    ;;;     > (+ 1 2)
    ;;;     3
    ;;;     > (defvar x 34)
    ;;;     X
    ;;;     > (defvar y 25)
    ;;;     Y
    ;;;     > (expt x y)
    ;;;     193630125104980427932766033374162714624
    ;;;     > (expt x (- y 12))
    ;;;     81138303245565435904
    ;;;     > 
    ;;; Now, exactly the same sequence of operations using OPFR syntax:
    ;;;     opfr> + 1 2
    ;;;      ==> 3
    ;;;     opfr> defvar x 34
    ;;;      ==> X
    ;;;     opfr> defvar y 25
    ;;;      ==> Y
    ;;;     opfr> expt x y
    ;;;      ==> 193630125104980427932766033374162714624
    ;;;     opfr> expt x (- y 12)
    ;;;      ==> 81138303245565435904
    ;;;     opfr>
    ;;;
    ;;; Note: The average Lisp programmer will see no significant advantage to
    ;;; the OPFR syntax (and some disadvantages, such as the need to resolve
    ;;; the ambiguity of a naked symbol -- should OPFR print its value as
    ;;; a global variable or call it as a "command" function?), especially
    ;;; since sub-expressions must still be fully-parenthesized (as in the
    ;;; last example above). Nevertheless, experience with real users has
    ;;; shown that the acceptance of the OPFR syntax is *enormously* greater
    ;;; than the "pure" Lisp sexp. [Go figure... (*sigh*)]

Search for me & OPFR or me & HWTOOL and you'll see lots more examples, e.g.:

    Subject: Re: Why is LISP syntax superior?
    Message-ID: <c6CdndrAWrIcbgDZnZ2dnUVZ_qKdnZ2d@speakeasy.net>

    Subject: Re: sweet-expressions instead of s-expressions?
    Message-ID: <haednUzCwZrQmovYnZ2dnUVZ_tqdnZ2d@speakeasy.net>

    Subject: Re: MUSING: standard bodies vs benevolent dictators, popularity
    Message-ID: <r7ydnaOXnddSZjXeRVn-ug@speakeasy.net>

-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607