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

*To*: srfi-76@xxxxxxxxxxxxxxxxx, sperber@xxxxxxxxxxxxxxxxxxxxxxxxxxx*Subject*: Re: Comments on LET and constructors*From*: Andre van Tonder <andre@xxxxxxxxxxxxxxxxxxx>*Date*: Thu, 20 Oct 2005 15:08:09 -0400 (EDT)*Delivered-to*: srfi-76@xxxxxxxxxxxxxxxxx*Reply-to*: Andre van Tonder <andre@xxxxxxxxxxxxxxxxxxx>

A small question: Are the parent constructor arguments also in the scope of the LET? I think they should be. If they are, then we can at least express one of the "inexpressible" examples I listed: > ;; Conditionally instantiating the parent with different arguments: > ;; (actually this specific example can be expressed but would > ;; require the test for (= y 0) to be duplicated): > > (define-type rational > (parent finite-rational) > (constructor (lambda (x y) > (if (= y 0) > (instantiate (parent 1 0)) > (instantiate (parent x y)))))) as follows: (define-type rational (x y) (let ((parent-args (if (= y 0) (cons 1 0) (cons x y))))) (parent finite-rational (car parent-args) (cdr parent-args))) Cheers Andre

- Prev by Date:
**Re: Revision of SRFI 76 available - questions and comments** - Next by Date:
**Some BNF, multiple values** - Previous by thread:
**Comments on LET and constructors** - Next by thread:
**Re: Revision of SRFI 76 available - questions and comments** - Index(es):