Re: [racket-users] Confusing typed/racket error message

2017-10-03 Thread Sam Tobin-Hochstadt
Yes, that's definitely a bad error message, so we should try to
improve Typed Racket here.

Sam

On Tue, Oct 3, 2017 at 12:54 PM, Taahir Ahmed  wrote:
> Of course it's something simple like that.  You are correct, I changed
> it to `#:replacement?` and then the program typechecked and ran.
>
> It would be helpful if the error message showed me that I was passing
> extra arguments in the domain of the function, but at least now I know
> what was happening.
>
> Thanks!
>
> On Tue, Oct 3, 2017 at 10:29 AM, Shu-Hung You
>  wrote:
>> Hi Taahir,
>>
>> The keyword is #:replacement? instead of #:replacement (note the
>> question mark). I don't know enough Typed Racket to understand that
>> error message tho, sorry.
>>
>> Cheers,
>> Shu-Hung
>>
>> On Tue, Oct 3, 2017 at 1:40 AM, Taahir Ahmed  wrote:
>>> Hi,
>>>
>>> I have been implementing some toy problems in typed/racket.  However,
>>> I have hit a wall while trying to invoke `(random-sample)`.  This
>>> example program:
>>>
>>> 
>>> #lang typed/racket
>>>
>>> (require typed/racket/random)
>>>
>>> (define (example (limit : Integer)
>>>  (count : Integer))
>>>   : (Listof Integer)
>>>   (let* ((random-sample-inst (inst random-sample Integer)))
>>> (random-sample-inst (in-range -10 limit)
>>> count
>>> #:replacement #f)))
>>>
>>> (example 10 5)
>>> 
>>>
>>> gives the error message:
>>>
>>> 
>>> ; /home/ahmedtd/project/reinforcement-learning/type-reproducer.rkt:9:4:
>>> Type Checker: No function domains matched in function application:
>>> ; Types: (Sequenceof Integer) Integer Pseudo-Random-Generator #f * ->
>>> (Listof Integer)
>>> ;(Sequenceof Integer) Integer #f * -> (Listof Integer)
>>> ; Arguments: (Sequenceof Integer) Integer #f *
>>> ; Expected result: (Listof Integer)
>>> ;
>>> ;   in: (random-sample-inst (in-range -10 limit) count #:replacement #f)
>>> 
>>>
>>> Maybe I'm missing something obvious, but it seems like the types of
>>> the supplied arguments are an exact match for the types of the second
>>> candidate domain printed in the error message.
>>>
>>> Any ideas on how to invoke this function from typed/racket?
>>>
>>> Thanks,
>>>
>>> Taahir Ahmed
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups 
>>> "Racket Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an 
>>> email to racket-users+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Confusing typed/racket error message

2017-10-03 Thread Taahir Ahmed
Of course it's something simple like that.  You are correct, I changed
it to `#:replacement?` and then the program typechecked and ran.

It would be helpful if the error message showed me that I was passing
extra arguments in the domain of the function, but at least now I know
what was happening.

Thanks!

On Tue, Oct 3, 2017 at 10:29 AM, Shu-Hung You
 wrote:
> Hi Taahir,
>
> The keyword is #:replacement? instead of #:replacement (note the
> question mark). I don't know enough Typed Racket to understand that
> error message tho, sorry.
>
> Cheers,
> Shu-Hung
>
> On Tue, Oct 3, 2017 at 1:40 AM, Taahir Ahmed  wrote:
>> Hi,
>>
>> I have been implementing some toy problems in typed/racket.  However,
>> I have hit a wall while trying to invoke `(random-sample)`.  This
>> example program:
>>
>> 
>> #lang typed/racket
>>
>> (require typed/racket/random)
>>
>> (define (example (limit : Integer)
>>  (count : Integer))
>>   : (Listof Integer)
>>   (let* ((random-sample-inst (inst random-sample Integer)))
>> (random-sample-inst (in-range -10 limit)
>> count
>> #:replacement #f)))
>>
>> (example 10 5)
>> 
>>
>> gives the error message:
>>
>> 
>> ; /home/ahmedtd/project/reinforcement-learning/type-reproducer.rkt:9:4:
>> Type Checker: No function domains matched in function application:
>> ; Types: (Sequenceof Integer) Integer Pseudo-Random-Generator #f * ->
>> (Listof Integer)
>> ;(Sequenceof Integer) Integer #f * -> (Listof Integer)
>> ; Arguments: (Sequenceof Integer) Integer #f *
>> ; Expected result: (Listof Integer)
>> ;
>> ;   in: (random-sample-inst (in-range -10 limit) count #:replacement #f)
>> 
>>
>> Maybe I'm missing something obvious, but it seems like the types of
>> the supplied arguments are an exact match for the types of the second
>> candidate domain printed in the error message.
>>
>> Any ideas on how to invoke this function from typed/racket?
>>
>> Thanks,
>>
>> Taahir Ahmed
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to racket-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Confusing typed/racket error message

2017-10-03 Thread Shu-Hung You
Hi Taahir,

The keyword is #:replacement? instead of #:replacement (note the
question mark). I don't know enough Typed Racket to understand that
error message tho, sorry.

Cheers,
Shu-Hung

On Tue, Oct 3, 2017 at 1:40 AM, Taahir Ahmed  wrote:
> Hi,
>
> I have been implementing some toy problems in typed/racket.  However,
> I have hit a wall while trying to invoke `(random-sample)`.  This
> example program:
>
> 
> #lang typed/racket
>
> (require typed/racket/random)
>
> (define (example (limit : Integer)
>  (count : Integer))
>   : (Listof Integer)
>   (let* ((random-sample-inst (inst random-sample Integer)))
> (random-sample-inst (in-range -10 limit)
> count
> #:replacement #f)))
>
> (example 10 5)
> 
>
> gives the error message:
>
> 
> ; /home/ahmedtd/project/reinforcement-learning/type-reproducer.rkt:9:4:
> Type Checker: No function domains matched in function application:
> ; Types: (Sequenceof Integer) Integer Pseudo-Random-Generator #f * ->
> (Listof Integer)
> ;(Sequenceof Integer) Integer #f * -> (Listof Integer)
> ; Arguments: (Sequenceof Integer) Integer #f *
> ; Expected result: (Listof Integer)
> ;
> ;   in: (random-sample-inst (in-range -10 limit) count #:replacement #f)
> 
>
> Maybe I'm missing something obvious, but it seems like the types of
> the supplied arguments are an exact match for the types of the second
> candidate domain printed in the error message.
>
> Any ideas on how to invoke this function from typed/racket?
>
> Thanks,
>
> Taahir Ahmed
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Confusing typed/racket error message

2017-10-03 Thread Taahir Ahmed
Hi,

I have been implementing some toy problems in typed/racket.  However,
I have hit a wall while trying to invoke `(random-sample)`.  This
example program:


#lang typed/racket

(require typed/racket/random)

(define (example (limit : Integer)
 (count : Integer))
  : (Listof Integer)
  (let* ((random-sample-inst (inst random-sample Integer)))
(random-sample-inst (in-range -10 limit)
count
#:replacement #f)))

(example 10 5)


gives the error message:


; /home/ahmedtd/project/reinforcement-learning/type-reproducer.rkt:9:4:
Type Checker: No function domains matched in function application:
; Types: (Sequenceof Integer) Integer Pseudo-Random-Generator #f * ->
(Listof Integer)
;(Sequenceof Integer) Integer #f * -> (Listof Integer)
; Arguments: (Sequenceof Integer) Integer #f *
; Expected result: (Listof Integer)
;
;   in: (random-sample-inst (in-range -10 limit) count #:replacement #f)


Maybe I'm missing something obvious, but it seems like the types of
the supplied arguments are an exact match for the types of the second
candidate domain printed in the error message.

Any ideas on how to invoke this function from typed/racket?

Thanks,

Taahir Ahmed

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.