Ah. Thanks.

Robby

On Fri, May 28, 2010 at 8:51 PM, Sam Tobin-Hochstadt <sa...@ccs.neu.edu> wrote:
> On Fri, May 28, 2010 at 9:21 PM, Robby Findler
> <ro...@eecs.northwestern.edu> wrote:
>>> -      [else (loop (- i 1)
>>> +      [else (loop (sub1 i)
>>
>> Okay, I'll bite. Why does (- i 1) do something different than (sub1
>> i)? Is sub1 overloaded in some useful way that - cannot be? Or is it
>> something about the constant?
>
> `sub1' has the type, among others, of:
>
>  (Exact-Positive-Integer -> Exact-Nonnegative-Integer)
>
> In this example, `i' (the argument to `loop') has argument type
> `Exact-Nonnegative-Integer'.  But above that line, we've tested that
> `i' isn't 0.  So `i' is an `Exact-Positive-Integer'.  So the `sub1'
> call produces exactly the right type for the call to `loop'.  `-'
> can't have a type that does that, unless we special-case 1.
>
> --
> sam th
> sa...@ccs.neu.edu
>
_________________________________________________
  For list-related administrative tasks:
  http://list.cs.brown.edu/mailman/listinfo/plt-dev

Reply via email to