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

Re: [Scheme-reports] [r6rs-discuss] [scheme-reports] Scheme pattern matching & R*RS



On 2011-01-22, at 16:48, Andre van Tonder wrote:

> On Sat, 22 Jan 2011, John Cowan wrote:
> 
>> Andre van Tonder scripsit:
>> 
>>> You don't really gain much since you would still need to say something like
>>> 
>>>  (import (except (rnrs) + - * - /)
>>>          (flonum-operations))
>> 
>> Yes, that's what I mean by a single point of messiness.  But the alternative
>> is to use prefixed names at *every* point of call, without even the option
>> of changing or shortening the prefix.  IMHO that is a worse mess.
> 
> Technically, you can change or shorten it as follows:
> 
>   (import (rename (flonum-operations) (fx+ +) (fx- -) (fx* *) .......))

If I have syntax-case or some other macro system, I can write a macro 

  (in-floating-point
    (/ (+ (- b) (sqrt discriminant)) (* 2.0 a)))

that does the renaming inside the form. I would argue that this is clearer, and allows flonum arithmetic to coexist in the same piece of code with fixnum or generic arithmetic. It definitely beats renaming. 

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