Re: [racket-users] minor doc change proposal?
LGTM, but I should note that I already accepted Philip’s earlier suggestion. If you want to make further changes, go for it! John > On Nov 30, 2018, at 06:25, Greg Hendershott wrote: > > On Fri, Nov 30, 2018 at 5:58 AM Robby Findler > wrote: >> What about using the function >> >> (lambda (x) (and x #true)) >> >> And putting a short discussion of truthy and a link to elsewhere in the docs? > > Yeah. I feel like the `filter-map` doc would be fine with just that change. > > Already it tells you `filter-map` is made of `filter` and `map` -- > which are already clickable links right there! > > I think really it's the `filter` doc that needs improving. It talks > about the pred function returning "a true value". Should it say "any > value except #f"? > > (In the User's Guide, the only discussion of "truthy" I can find is > for things like `if`. The discussion is pretty much just "any value > except #f". Truthy is simpler in Racket than some other languages. > That's probably the only discussion needed -- to help people coming > from other langs? The only false value is #f. Everything else -- > including 0 '() null -- is true. Right?) > > -- > 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] minor doc change proposal?
On Fri, Nov 30, 2018 at 5:58 AM Robby Findler wrote: > What about using the function > > (lambda (x) (and x #true)) > > And putting a short discussion of truthy and a link to elsewhere in the docs? Yeah. I feel like the `filter-map` doc would be fine with just that change. Already it tells you `filter-map` is made of `filter` and `map` -- which are already clickable links right there! I think really it's the `filter` doc that needs improving. It talks about the pred function returning "a true value". Should it say "any value except #f"? (In the User's Guide, the only discussion of "truthy" I can find is for things like `if`. The discussion is pretty much just "any value except #f". Truthy is simpler in Racket than some other languages. That's probably the only discussion needed -- to help people coming from other langs? The only false value is #f. Everything else -- including 0 '() null -- is true. Right?) -- 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] minor doc change proposal?
What about using the function (lambda (x) (and x #true)) And putting a short discussion of truthy and a link to elsewhere in the docs? Robby On Thu, Nov 29, 2018 at 11:17 PM Philip McGrath wrote: > I can do it. > > -Philip > > > On Thu, Nov 29, 2018 at 5:17 PM John Clements > wrote: > >> I like your idea better than mine. Do you have time to make it a pull >> request? If not, I’ll do it. >> >> John >> >> > On Nov 29, 2018, at 2:08 PM, Philip McGrath >> wrote: >> > >> > I would find `true?` confusing, since it really means "truthy." For >> example, in Rackunit, `check-not-false` has this behavior, whereas >> `check-true` checks that the result is really `eq?` to `#t`. >> > >> > Personally, I think it might be better to clarify the documentation >> with more prose, rather than adding a new binding to the standard library. >> Maybe something like this? >> > Like (map proc lst ...), except that, when `proc` returns `#f`, that >> element is omitted from the resulting list. In other words, filter-map is >> equivalent to (filter (lambda (x) x) (map proc lst ...)), but more >> efficient, because filter-map avoids building the intermediate list. >> > >> > -Philip >> > >> > >> > On Thu, Nov 29, 2018 at 3:25 PM Gustavo Massaccesi >> wrote: >> > This function is a already defined in a few libraries and it is called >> `true?` for example in >> https://docs.racket-lang.org/predicates/index.html?q=true#%28def._%28%28lib._predicates%2Fmain..rkt%29._true~3f%29%29 >> > >> > I think that `not-false?` is easier to understand, but `true?` is more >> idiomatic. >> > >> > Gustavo >> > >> > >> > >> > >> > On Thu, Nov 29, 2018 at 3:11 PM 'John Clements' via Racket Users < >> racket-users@googlegroups.com> wrote: >> > This stack overflow post >> > >> > >> https://stackoverflow.com/questions/53543191/what-is-the-different-between-filter-and-filter-map/53545115#53545115 >> > >> > … is written by someone confused by the documentation for `filter-map`. >> I went and read the documentation, and *I* was confused for about 30 >> seconds. I eventually proposed rewriting the existing >> > >> > Returns (filter (lambda (x) x) (map proc lst ...)), but without >> building the intermediate list. >> > >> > to >> > >> > Returns (filter not-false? (map proc lst ...)), but without building >> the intermediate list, where not-false? can be defined as (lambda (x) x). >> > >> > This text is kludgier, but I think that the use of (lambda (x) x) as >> “not-false?” is idiomatic and confusing. And yes, I realize that this >> suggestion probably applies to many places in the docs. Maybe I should just >> propose adding `not-false?` as a library function, defined as (lambda (x) >> x)…. >> > >> > >> > John >> > >> > >> > >> > -- >> > 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. > -- 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] minor doc change proposal?
I can do it. -Philip On Thu, Nov 29, 2018 at 5:17 PM John Clements wrote: > I like your idea better than mine. Do you have time to make it a pull > request? If not, I’ll do it. > > John > > > On Nov 29, 2018, at 2:08 PM, Philip McGrath > wrote: > > > > I would find `true?` confusing, since it really means "truthy." For > example, in Rackunit, `check-not-false` has this behavior, whereas > `check-true` checks that the result is really `eq?` to `#t`. > > > > Personally, I think it might be better to clarify the documentation with > more prose, rather than adding a new binding to the standard library. Maybe > something like this? > > Like (map proc lst ...), except that, when `proc` returns `#f`, that > element is omitted from the resulting list. In other words, filter-map is > equivalent to (filter (lambda (x) x) (map proc lst ...)), but more > efficient, because filter-map avoids building the intermediate list. > > > > -Philip > > > > > > On Thu, Nov 29, 2018 at 3:25 PM Gustavo Massaccesi > wrote: > > This function is a already defined in a few libraries and it is called > `true?` for example in > https://docs.racket-lang.org/predicates/index.html?q=true#%28def._%28%28lib._predicates%2Fmain..rkt%29._true~3f%29%29 > > > > I think that `not-false?` is easier to understand, but `true?` is more > idiomatic. > > > > Gustavo > > > > > > > > > > On Thu, Nov 29, 2018 at 3:11 PM 'John Clements' via Racket Users < > racket-users@googlegroups.com> wrote: > > This stack overflow post > > > > > https://stackoverflow.com/questions/53543191/what-is-the-different-between-filter-and-filter-map/53545115#53545115 > > > > … is written by someone confused by the documentation for `filter-map`. > I went and read the documentation, and *I* was confused for about 30 > seconds. I eventually proposed rewriting the existing > > > > Returns (filter (lambda (x) x) (map proc lst ...)), but without building > the intermediate list. > > > > to > > > > Returns (filter not-false? (map proc lst ...)), but without building the > intermediate list, where not-false? can be defined as (lambda (x) x). > > > > This text is kludgier, but I think that the use of (lambda (x) x) as > “not-false?” is idiomatic and confusing. And yes, I realize that this > suggestion probably applies to many places in the docs. Maybe I should just > propose adding `not-false?` as a library function, defined as (lambda (x) > x)…. > > > > > > John > > > > > > > > -- > > 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] minor doc change proposal?
I like your idea better than mine. Do you have time to make it a pull request? If not, I’ll do it. John > On Nov 29, 2018, at 2:08 PM, Philip McGrath wrote: > > I would find `true?` confusing, since it really means "truthy." For example, > in Rackunit, `check-not-false` has this behavior, whereas `check-true` checks > that the result is really `eq?` to `#t`. > > Personally, I think it might be better to clarify the documentation with more > prose, rather than adding a new binding to the standard library. Maybe > something like this? > Like (map proc lst ...), except that, when `proc` returns `#f`, that element > is omitted from the resulting list. In other words, filter-map is equivalent > to (filter (lambda (x) x) (map proc lst ...)), but more efficient, because > filter-map avoids building the intermediate list. > > -Philip > > > On Thu, Nov 29, 2018 at 3:25 PM Gustavo Massaccesi wrote: > This function is a already defined in a few libraries and it is called > `true?` for example in > https://docs.racket-lang.org/predicates/index.html?q=true#%28def._%28%28lib._predicates%2Fmain..rkt%29._true~3f%29%29 > > I think that `not-false?` is easier to understand, but `true?` is more > idiomatic. > > Gustavo > > > > > On Thu, Nov 29, 2018 at 3:11 PM 'John Clements' via Racket Users > wrote: > This stack overflow post > > https://stackoverflow.com/questions/53543191/what-is-the-different-between-filter-and-filter-map/53545115#53545115 > > … is written by someone confused by the documentation for `filter-map`. I > went and read the documentation, and *I* was confused for about 30 seconds. I > eventually proposed rewriting the existing > > Returns (filter (lambda (x) x) (map proc lst ...)), but without building the > intermediate list. > > to > > Returns (filter not-false? (map proc lst ...)), but without building the > intermediate list, where not-false? can be defined as (lambda (x) x). > > This text is kludgier, but I think that the use of (lambda (x) x) as > “not-false?” is idiomatic and confusing. And yes, I realize that this > suggestion probably applies to many places in the docs. Maybe I should just > propose adding `not-false?` as a library function, defined as (lambda (x) x)…. > > > John > > > > -- > 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] minor doc change proposal?
I would find `true?` confusing, since it really means "truthy." For example, in Rackunit, `check-not-false` has this behavior, whereas `check-true` checks that the result is really `eq?` to `#t`. Personally, I think it might be better to clarify the documentation with more prose, rather than adding a new binding to the standard library. Maybe something like this? > Like (map proc lst ...), except that, when `proc` returns `#f`, that > element is omitted from the resulting list. In other words, filter-map is > equivalent to (filter (lambda (x) x) (map proc lst ...)), but more > efficient, because filter-map avoids building the intermediate list. > -Philip On Thu, Nov 29, 2018 at 3:25 PM Gustavo Massaccesi wrote: > This function is a already defined in a few libraries and it is called > `true?` for example in > https://docs.racket-lang.org/predicates/index.html?q=true#%28def._%28%28lib._predicates%2Fmain..rkt%29._true~3f%29%29 > > I think that `not-false?` is easier to understand, but `true?` is more > idiomatic. > > Gustavo > > > > > On Thu, Nov 29, 2018 at 3:11 PM 'John Clements' via Racket Users < > racket-users@googlegroups.com> wrote: > >> This stack overflow post >> >> >> https://stackoverflow.com/questions/53543191/what-is-the-different-between-filter-and-filter-map/53545115#53545115 >> >> … is written by someone confused by the documentation for `filter-map`. I >> went and read the documentation, and *I* was confused for about 30 seconds. >> I eventually proposed rewriting the existing >> >> Returns (filter (lambda (x) x) (map proc lst ...)), but without building >> the intermediate list. >> >> to >> >> Returns (filter not-false? (map proc lst ...)), but without building the >> intermediate list, where not-false? can be defined as (lambda (x) x). >> >> This text is kludgier, but I think that the use of (lambda (x) x) as >> “not-false?” is idiomatic and confusing. And yes, I realize that this >> suggestion probably applies to many places in the docs. Maybe I should just >> propose adding `not-false?` as a library function, defined as (lambda (x) >> x)…. >> >> >> John >> >> >> >> -- >> 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] minor doc change proposal?
This function is a already defined in a few libraries and it is called `true?` for example in https://docs.racket-lang.org/predicates/index.html?q=true#%28def._%28%28lib._predicates%2Fmain..rkt%29._true~3f%29%29 I think that `not-false?` is easier to understand, but `true?` is more idiomatic. Gustavo On Thu, Nov 29, 2018 at 3:11 PM 'John Clements' via Racket Users < racket-users@googlegroups.com> wrote: > This stack overflow post > > > https://stackoverflow.com/questions/53543191/what-is-the-different-between-filter-and-filter-map/53545115#53545115 > > … is written by someone confused by the documentation for `filter-map`. I > went and read the documentation, and *I* was confused for about 30 seconds. > I eventually proposed rewriting the existing > > Returns (filter (lambda (x) x) (map proc lst ...)), but without building > the intermediate list. > > to > > Returns (filter not-false? (map proc lst ...)), but without building the > intermediate list, where not-false? can be defined as (lambda (x) x). > > This text is kludgier, but I think that the use of (lambda (x) x) as > “not-false?” is idiomatic and confusing. And yes, I realize that this > suggestion probably applies to many places in the docs. Maybe I should just > propose adding `not-false?` as a library function, defined as (lambda (x) > x)…. > > > John > > > > -- > 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.