[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] How about relaxing a dot notation restriction?



(plus 1 . (2 3)) is indistinguishable from (plus 1 2 3), so there's not "special" being permitted here.

Your other example could only ever be valid if the "dotted" form always evaluates to a list.   As such it would always be equivalent to:

     (apply plus 1 two-three)

so there's nothing new of value here.





On Fri, Mar 22, 2013 at 9:06 AM, Sascha Ziemann <ceving@x> wrote:
Hello,

the dot notation is allowed in function definitions:

(define (plus first . rest)
  (if (null? rest)
      first
      (+ first (apply plus rest))))

(plus 1 2 3) => 6

And in literals:

(plus 1 . (2 3)) => 6

But not in function applications:

(define two-three '(2 3))
(plus 1 . two-three) => ERROR

How about relaxing this restriction?

Regards
Sascha

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports