Re: [racket-users] raise-argument-error missing list?

2019-07-08 Thread Matthias Felleisen
We all are indeed at Racket school. The arguments for/against contracts have been made over and over again especially by Betrand Meyers, before we even introduced and studied the higher-order boundary-tied variant. + Contracts separate the core functionality of a service module from its

Re: [racket-users] raise-argument-error missing list?

2019-07-08 Thread Sorawee Porncharoenwase
On Mon, Jul 8, 2019 at 12:56 PM Greg Hendershott rac...@greghendershott.com wrote: - The return value is `any` -- not even `any/c`, just `any`. Effectively > don't check the return value(s). > If I use define/contract, does any restore tail-recursion?

Re: [racket-users] raise-argument-error missing list?

2019-07-08 Thread Greg Hendershott
I'll chime in only because some of the usual suspects who could best answer this might be busy with the Racket summer school this week. I believe that function contracts can be about as fast as the sort of checks you'd code by hand, provided that: - The parameter contracts are simple, flat,

Re: [racket-users] raise-argument-error missing list?

2019-07-08 Thread Kevin Forchione
> On Jul 8, 2019, at 10:41 AM, David Storrs wrote: > > Nothing specific that I'm aware of, but others could answer this better. If > there are then they're probably related to speed. > > Personally, I'm quite fond of them because they eliminate the need for a lot > of tests and make the

Re: [racket-users] raise-argument-error missing list?

2019-07-08 Thread David Storrs
Nothing specific that I'm aware of, but others could answer this better. If there are then they're probably related to speed. Personally, I'm quite fond of them because they eliminate the need for a lot of tests and make the code much more self-documenting. Function contracts are detailed here:

Re: [racket-users] raise-argument-error missing list?

2019-07-08 Thread Kevin Forchione
> On Jul 8, 2019, at 8:17 AM, David Storrs wrote: > > Note that in many cases it can be better to use a contract as opposed to an > explicit check. For example, you could replace this: > > (define (feed-animals cow sheep goose cat) > (if (not (eq? goose 'goose)) >

Re: [racket-users] raise-argument-error missing list?

2019-07-08 Thread David Storrs
Staircase thought: I shouldn't have said 'precisely equivalent' since the text of the error message may differ. 'Semantically equivalent' is more correct. On Mon, Jul 8, 2019 at 11:17 AM David Storrs wrote: > Note that in many cases it can be better to use a contract as opposed to > an

Re: [racket-users] raise-argument-error missing list?

2019-07-08 Thread David Storrs
Note that in many cases it can be better to use a contract as opposed to an explicit check. For example, you could replace this: (define (feed-animals cow sheep goose cat) (if (not (eq? goose 'goose)) (raise-argument-error 'feed-animals "'goose" 2 cow sheep goose cat) "fed the

Re: [racket-users] raise-argument-error missing list?

2019-07-05 Thread Kevin Forchione
> On Jul 5, 2019, at 10:51 AM, Matthew Flatt wrote: > > DrRacket hides the other arguments to make the error message initially > more compact. Click "..." in DrRacket to expose the arguments. > Thanks! The explanation has suddenly made it “intuitive” to me :) Kevin -- You received this

Re: [racket-users] raise-argument-error missing list?

2019-07-05 Thread Matthew Flatt
DrRacket hides the other arguments to make the error message initially more compact. Click "..." in DrRacket to expose the arguments. At Fri, 5 Jul 2019 10:49:09 -0700, Kevin Forchione wrote: > Hi guys, > Been adding raise-argument-error to my functions to catch errors and have > noticed that

[racket-users] raise-argument-error missing list?

2019-07-05 Thread Kevin Forchione
Hi guys, Been adding raise-argument-error to my functions to catch errors and have noticed that the 2nd version of the form doesn’t actually list the other arguments - even for the example in the docs: >(define (feed-animals cow sheep goose cat) (if (not (eq? goose 'goose))