Re: [racket-dev] first and rest in racket/base
At Thu, 13 Dec 2012 14:51:42 -0500, Eli Barzilay wrote: > A few minutes ago, Jay McCarthy wrote: > > I agree with Eli. first is not car and shouldn't be treated as it. > > > > car : (Cons a b) -> a > > first : (List a) -> a > > Right -- it's a different type, and the `list?' check adds a cost. > > I don't have too much problem with how they are now -- it's just that > moving them to the base language makes it easier to think that they're > the same thing, even more in the presence of the CL thing (where they > are the same). `racket/base' already has both `pair?' and `list?', and I don't think anyone is getting confused. `#lang racket' has all of them, and that does not seem to cause any issues either. I could amend my patch to move the documentation of `first' and `rest' with the other list operations in `racket/base' (`length', `list-ref', etc.) instead of with `car' and `cdr'. Do you think that would help? Vincent _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] first and rest in racket/base
20 minutes ago, Carl Eastlund wrote: > If they do the wrong thing, we should fix them, not deprecate them. I'm not saying that they should be deprecated. > We're not LISP, let's not promote car/cdr as the primary names for > list operations. And I'm not suggesting that either. (In fact, in *C*L, `first' and `rest' are strongly encouraged.) A few minutes ago, Jay McCarthy wrote: > I agree with Eli. first is not car and shouldn't be treated as it. > > car : (Cons a b) -> a > first : (List a) -> a Right -- it's a different type, and the `list?' check adds a cost. I don't have too much problem with how they are now -- it's just that moving them to the base language makes it easier to think that they're the same thing, even more in the presence of the CL thing (where they are the same). > I also agree with Carl that we should deprecate grandpa's names and > give nice names. I suggest "fst" and "snd" and "pair" Re grandpa names -- that's a kind of a discussion that happens very frequently on practically every lisp dialect I know of. Eventually, there's not much to do -- and like I tell my students, I sometimes make sure that my class notes don't have `car'/`cdr' but when I write code in class I always get back to it. And as for new names -- `fst' and `snd' are not good because considering the cdr of a list as `snd' is deceptive, and because the two names are used elsewhere as tuple accessors. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] first and rest in racket/base
Vincent's proposal wasn't "let's treat car as first", his proposal was "let's export it in racket/base". If we don't like first/rest, we should have a proposal to remove them from #lang racket... right? Otherwise, let's put them in racket/base. They're very simple names for very, very common operations. I use them all the time, and it makes me write different code in racket/base than in racket when I can't get them. I would like to either always have them, or be convinced of why I should never have them. Carl Eastlund On Thu, Dec 13, 2012 at 2:40 PM, Jay McCarthy wrote: > I agree with Eli. first is not car and shouldn't be treated as it. > > car : (Cons a b) -> a > first : (List a) -> a > > I also agree with Carl that we should deprecate grandpa's names and > give nice names. I suggest "fst" and "snd" and "pair" > > Jay > > On Thu, Dec 13, 2012 at 12:26 PM, Carl Eastlund wrote: > > If they do the wrong thing, we should fix them, not deprecate them. > We're > > not LISP, let's not promote car/cdr as the primary names for list > > operations. > > > > Carl Eastlund > > > > > > > > On Thu, Dec 13, 2012 at 2:19 PM, Eli Barzilay wrote: > >> > >> -1, since they are different from what some people would expect them > >> to do. -2 for the `empty', `cons?' etc aliases. > >> > >> > >> An hour and a half ago, Vincent St-Amour wrote: > >> > I just got tripped up, again, trying to traverse a list with `first' > >> > and `rest' in a `racket/base' file. `first' and `rest' are only > >> > available in `racket' and `racket/list', but not in `racket/base'. > >> > > >> > If we want to encourage use of `first' and `rest' over `car' and > >> > `cdr' and of `racket/base' when possible (which, e.g., the style > >> > guide does), I think it makes sense to provide `first' and `rest' in > >> > `racket/base'. > >> > > >> > The attached patch implements that change. > >> > > >> > Does this sound reasonable? > >> > >> -- > >> ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: > >> http://barzilay.org/ Maze is > Life! > >> _ > >> Racket Developers list: > >> http://lists.racket-lang.org/dev > >> > > > > > > _ > > Racket Developers list: > > http://lists.racket-lang.org/dev > > > > > > -- > Jay McCarthy > Assistant Professor / Brigham Young University > http://faculty.cs.byu.edu/~jay > > "The glory of God is Intelligence" - D&C 93 > > _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] first and rest in racket/base
I agree with Eli. first is not car and shouldn't be treated as it. car : (Cons a b) -> a first : (List a) -> a I also agree with Carl that we should deprecate grandpa's names and give nice names. I suggest "fst" and "snd" and "pair" Jay On Thu, Dec 13, 2012 at 12:26 PM, Carl Eastlund wrote: > If they do the wrong thing, we should fix them, not deprecate them. We're > not LISP, let's not promote car/cdr as the primary names for list > operations. > > Carl Eastlund > > > > On Thu, Dec 13, 2012 at 2:19 PM, Eli Barzilay wrote: >> >> -1, since they are different from what some people would expect them >> to do. -2 for the `empty', `cons?' etc aliases. >> >> >> An hour and a half ago, Vincent St-Amour wrote: >> > I just got tripped up, again, trying to traverse a list with `first' >> > and `rest' in a `racket/base' file. `first' and `rest' are only >> > available in `racket' and `racket/list', but not in `racket/base'. >> > >> > If we want to encourage use of `first' and `rest' over `car' and >> > `cdr' and of `racket/base' when possible (which, e.g., the style >> > guide does), I think it makes sense to provide `first' and `rest' in >> > `racket/base'. >> > >> > The attached patch implements that change. >> > >> > Does this sound reasonable? >> >> -- >> ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: >> http://barzilay.org/ Maze is Life! >> _ >> Racket Developers list: >> http://lists.racket-lang.org/dev >> > > > _ > Racket Developers list: > http://lists.racket-lang.org/dev > -- Jay McCarthy Assistant Professor / Brigham Young University http://faculty.cs.byu.edu/~jay "The glory of God is Intelligence" - D&C 93 _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] first and rest in racket/base
If they do the wrong thing, we should fix them, not deprecate them. We're not LISP, let's not promote car/cdr as the primary names for list operations. Carl Eastlund On Thu, Dec 13, 2012 at 2:19 PM, Eli Barzilay wrote: > -1, since they are different from what some people would expect them > to do. -2 for the `empty', `cons?' etc aliases. > > > An hour and a half ago, Vincent St-Amour wrote: > > I just got tripped up, again, trying to traverse a list with `first' > > and `rest' in a `racket/base' file. `first' and `rest' are only > > available in `racket' and `racket/list', but not in `racket/base'. > > > > If we want to encourage use of `first' and `rest' over `car' and > > `cdr' and of `racket/base' when possible (which, e.g., the style > > guide does), I think it makes sense to provide `first' and `rest' in > > `racket/base'. > > > > The attached patch implements that change. > > > > Does this sound reasonable? > > -- > ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: > http://barzilay.org/ Maze is Life! > _ > Racket Developers list: > http://lists.racket-lang.org/dev > > _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] first and rest in racket/base
-1, since they are different from what some people would expect them to do. -2 for the `empty', `cons?' etc aliases. An hour and a half ago, Vincent St-Amour wrote: > I just got tripped up, again, trying to traverse a list with `first' > and `rest' in a `racket/base' file. `first' and `rest' are only > available in `racket' and `racket/list', but not in `racket/base'. > > If we want to encourage use of `first' and `rest' over `car' and > `cdr' and of `racket/base' when possible (which, e.g., the style > guide does), I think it makes sense to provide `first' and `rest' in > `racket/base'. > > The attached patch implements that change. > > Does this sound reasonable? -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] first and rest in racket/base
Throw cons? in with empty?, please. Carl Eastlund On Thu, Dec 13, 2012 at 2:13 PM, Asumu Takikawa wrote: > On 2012-12-13 12:44:38 -0500, Vincent St-Amour wrote: > > Does this sound reasonable? > > +1. While we're at it, might as well also put at least `empty` and > `empty?` in there too. These trip me up as well. > > Cheers, > Asumu > _ > Racket Developers list: > http://lists.racket-lang.org/dev > > _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] first and rest in racket/base
On 2012-12-13 12:44:38 -0500, Vincent St-Amour wrote: > Does this sound reasonable? +1. While we're at it, might as well also put at least `empty` and `empty?` in there too. These trip me up as well. Cheers, Asumu _ Racket Developers list: http://lists.racket-lang.org/dev
[racket-dev] first and rest in racket/base
I just got tripped up, again, trying to traverse a list with `first' and `rest' in a `racket/base' file. `first' and `rest' are only available in `racket' and `racket/list', but not in `racket/base'. If we want to encourage use of `first' and `rest' over `car' and `cdr' and of `racket/base' when possible (which, e.g., the style guide does), I think it makes sense to provide `first' and `rest' in `racket/base'. The attached patch implements that change. Does this sound reasonable? Vincent 0001-Move-first-and-rest-to-racket-base.patch Description: Binary data _ Racket Developers list: http://lists.racket-lang.org/dev