Hacker News new | ask | show | jobs
by tobinfricke 1036 days ago
What is R7RS?
2 comments

It's the Revised Revised Revised Revised Revised Revised Revised Report on the algorithmic programming language Scheme. That's 7 "Revised"s, hence R7RS. Basically the RxRSes are full specifications of what you need in a Scheme implementation to conform to the Xth iteration of the language.
(Revised (Revised (Revised (Revised (Revised (Revised (Revised Report)))))))
I like using arrow-macros (threading macros) myself;

  (-> report
      revised
      revised
      revised
      revised
      revised
      revised
      revised)
That is not in the style of srfi-197.

    (chain report
           (revised _)
           (revised _)
           ...)
There are benefits to this approach, such as it handling both applying returned lists and multiple return values by default.
(very (very (very (well (said)))))

  CL-USER 21 > (let ((n 7)
                     (report '(report)))
                 (flet ((revise (report)
                          (cons 'revised report)))
                   (do ((report report (revise report))
                        (i 0 (1+ i)))
                       ((= i n) report))))
  (REVISED REVISED REVISED REVISED REVISED REVISED REVISED REPORT)
So weird seeing CL code without a bunch of (declare (type (integer 0) n))'s everywhere. That's the only thing which keeps me with CL instead of Scheme (I'm rather fond of syntax-rules, case-lambda, case sensitivity, and being able to do things like...

  (define range+ (make-range-merger +))
  (define (double-range range)
    (range+ range range))
, which I think is a little nicer than

  (setf (fdefinition range+)
    (make-range-merger #'+))
or having to precede range+ with funcall everywhere I want to use it).
Personally I find Common Lisp in some cases slightly uglier, but clearer.

  (define foo (make-foo))
What is it? A function or a non-function?

I prefer the Common Lisp version:

  (defvar *foo* (make-foo)
    "*foo* is the current input/output foo object.")
It's clear that DEFVAR usually defines a variable and not a function. Bonus: we can document the thing in a standard way.

For functions I would define a define macro.

  (define foo (make-foo)
    "foo is a function with two arguments of type bar, it returns ..."
    (ftype (function (bar bar) baz))
Which would expand into a (setf fdefinition), a type declaration and setting the documentation.

I prefer the uglier, but better standardized and slightly more practical language.

that's an interesting naming convention!
Revised report version 7. The current scheme standardization. It proceeded R6RS which many felt was too large, and added too many things to the scheme standard (it’s only 90 pages long). R7RS was the compromise
Exactly. R7RS-small was meant to be a minimal core language, in the spirit of RnRS for n <= 5, whereas R7RS-large was meant to be a fairly complete set of standard libraries.