Subject: Inaccurate api-procedures manual sentence on lambda formal arguments

From: Richard Sent <[email-masked]>
Date: Wed, 20 Mar 2024 13:40:58 -0400

Hi Guile,

I noticed the following line in the manual on (lambda) in (info "(guile)
Lambda"). Emphasis in **.

> -- syntax: lambda formals body
>     ...
>     ‘(VARIABLE1 ... VARIABLEN . VARIABLEN+1)’
>          If a space-delimited period precedes the last variable, then
>          the procedure takes N or more variables where N is the number
>          of formal arguments before the period.  *There must be at
>          least one argument before the period.*

That would mean a procedure like

--8<---------------cut here---------------start------------->8---
((lambda ( . args)
  args) 1) ;=>(1) runs fine in 3.0.9
--8<---------------cut here---------------end--------------->8---

is invalid because there isn't an argument before the period. I've
encountered Guile code that relies on this behavior before, even in the
Guile repo. For example, in guile/benchmark/measure.scm:

--8<---------------cut here---------------start------------->8---
(define (measure . args)
 ...)
;; should be identical to
(define measure (lambda ( . args) ...))
--8<---------------cut here---------------end--------------->8---

Ergo, I think the sentence

> There must be at least one argument before the period

should be removed. This line seems to be from the R5RS standard [1], but
this sentence is in api-procedures.texi, not the R5RS manual, so I
assume it should reflect Guile's implementation.

[1] https://conservatory.scheme.org/schemers/Documents/Standards/R5RS/HTML/r5rs-Z-H-2.html#%_toc_%_sec_4.1.4

-- 
Take it easy,
Richard Sent
Making my computer weirder one commit at a time.