Re: [racket-dev] typed/scheme n00b question

2010-09-07 Thread Sam Tobin-Hochstadt
On Tue, Sep 7, 2010 at 8:04 AM, Robby Findler
ro...@eecs.northwestern.edu wrote:

 You can't use that type in `require/typed', though, since the contract
 library doesn't accept `case-' contracts like that.

 The like that part is that two different arms of the case- would
 have the same arity?

Right.  Of course, even if the contract library accepted such
contracts when it could distinguish based on the first-order portions
which case to take, that still wouldn't cover all of what TR accepts.
More work is needed (on my part) to characterize it precisely, though.
-- 
sam th
sa...@ccs.neu.edu
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


Re: [racket-dev] typed/scheme n00b question

2010-09-07 Thread Eli Barzilay
On Sep  7, Jay McCarthy wrote:
 On Tue, Sep 7, 2010 at 5:54 AM, Sam Tobin-Hochstadt sa...@ccs.neu.edu wrote:
  On Mon, Sep 6, 2010 at 10:28 PM, Eli Barzilay e...@barzilay.org wrote:
  On Sep  6, Sam Tobin-Hochstadt wrote:
  On Sun, Sep 5, 2010 at 5:30 PM, Eli Barzilay e...@barzilay.org wrote:
  
   I think that this is the type for `file-or-directory-modify-seconds':
  
    (case-lambda
      [String - Exact-Nonnegative-Integer]
      [String (Option Exact-Nonnegative-Integer)
              - (U Exact-Nonnegative-Integer Void)]
      [String (Option Exact-Nonnegative-Integer) (- Any)
              - Any])
 
  Probably you want something more specific that handles the [String
  Integer] and [String False] cases separately.
 
  Yeah, but that's the part that I can never remember.  This:
 
   (U (String - Exact-Nonnegative-Integer)
      (String False - Exact-Nonnegative-Integer)
      (String Exact-Nonnegative-Integer - Void)
      (String (Option Exact-Nonnegative-Integer) (- Any) - Any))
 
  is more precise, but IIRC, it's not equivalent to the above -- ?
 
  Why does everyone always want to use union for this?

I vaguely remembered that unions don't work for functions, and
therefore didn't use one (also that ? is exactly about it.)


  Everything you wrote there is correct, except that `U' should be
  `case-lambda'.
 
 There is something to be said for making the things that everyone
 writes first be the thing they should write. It is natural to me to
 think of a function with multiple arrow types as a union of some
 arrow types. Would it be so hard for Typed Racket to see a union of
 all arrows and just consider that the same as case-lambda? Is that
 wrong?  If it is fundamentally wrong, some better form of
 explanation in the docs seem warranted.

+1 to all of that.  [Why does everyone reminds me of a teacher who
had about 112 students out of a class of 120 students fail a course --
and concluded that it was a very weak class.]

-- 
  ((lambda (x) (x x)) (lambda (x) (x x)))  Eli Barzilay:
http://barzilay.org/   Maze is Life!
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev

Re: [racket-dev] typed/scheme n00b question

2010-09-06 Thread Eli Barzilay
On Sep  6, Sam Tobin-Hochstadt wrote:
 On Sun, Sep 5, 2010 at 5:30 PM, Eli Barzilay e...@barzilay.org wrote:
 
  I think that this is the type for `file-or-directory-modify-seconds':
 
   (case-lambda
     [String - Exact-Nonnegative-Integer]
     [String (Option Exact-Nonnegative-Integer)
             - (U Exact-Nonnegative-Integer Void)]
     [String (Option Exact-Nonnegative-Integer) (- Any)
             - Any])
 
 Probably you want something more specific that handles the [String
 Integer] and [String False] cases separately.

Yeah, but that's the part that I can never remember.  This:

  (U (String - Exact-Nonnegative-Integer)
 (String False - Exact-Nonnegative-Integer)
 (String Exact-Nonnegative-Integer - Void)
 (String (Option Exact-Nonnegative-Integer) (- Any) - Any))

is more precise, but IIRC, it's not equivalent to the above -- ?

-- 
  ((lambda (x) (x x)) (lambda (x) (x x)))  Eli Barzilay:
http://barzilay.org/   Maze is Life!
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev