Poor documentation of List*

49 views
Skip to first unread message

Hendrik Boom

unread,
Jun 2, 2020, 10:13:54 AM6/2/20
to Racket Users
In the Typed Racket Reference, List* is defined as follows:

(List* t t1 ... s)

is equivalent to (Pairof t (List* t1 ... s)).

Following this definition down, we get

(List* a b c)
-> (Pairof a (List* b c))
-> (Pairof a (Pairof b (List* c)))

But what's (List* c) ?

I see no explanatory examples.

-- hendrik

P.S. I'm also unsure what 'bound' is supposed to do in

(List t ... trest ... bound)

It says "where bound must be an identifier denoting a type variable
bound with ..." but I don't undestand what this is referring to.

There are no examples of this in the document, just as there are no
examples of List*.

-- hendrik

Stephen De Gabrielle

unread,
Jun 3, 2020, 11:22:57 AM6/3/20
to Racket Users
Hi Hendrik, 

I can't see the example you mention in 

i'm assuming (List* c) is shorthand for (Pair c null)? I don't know typed racket so I've probably got that terribly wrong. 

So while I can't help you with this - I wanted to encourage you to make a PR to the documentation if you come up with a fix.
It *used* to be hard to find the file that needs the fix, good steps have been made recently to make it easier to identify the documentation source file so it is easier to find and make the corrections or additions.

If you have any trouble let me know and I'll try help - I think I'm getting the hang of it.

Hope you are well

Kind regards

Stephen

ps i use https://blog.racket-lang.org/2017/09/tutorial-contributing-to-racket.html & lots of kind guidance from other racketeers :0
pps: if you make a successful pr you get credit in the frankly wonderful racket news https://racket-news.com/2020/06/racket-news-issue-32.html

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/20200602141347.3z7igvzbjyikhfn4%40topoi.pooq.com.

Hendrik Boom

unread,
Jun 3, 2020, 3:49:11 PM6/3/20
to Racket Users
On Wed, Jun 03, 2020 at 04:22:41PM +0100, Stephen De Gabrielle wrote:
> Hi Hendrik,
>
> I can't see the example you mention in
> https://docs.racket-lang.org/ts-reference/type-ref.html#%28form._%28%28lib._typed-racket%2Fbase-env%2Fbase-types-extra..rkt%29._.List%2A%29%29
>
> i'm assuming (List* c) is shorthand for (Pair c null)? I don't know typed
> racket so I've probably got that terribly wrong.

It might be. But that's normally said as (List c), not List* c)
With your interpretation, List* qould be equivalent to List.

>
> So while I can't help you with this - I wanted to encourage you to make a
> PR to the documentation if you come up with a fix.

My problem is that I don't know what the documentation is supposed to say.

-- hendrik
> To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CAGHj7-LsML%2BeOnt_BUBWmRM5vU6GtovyaNr-JHOQPzoMCL2NTQ%40mail.gmail.com.

Sam Tobin-Hochstadt

unread,
Jun 3, 2020, 4:22:41 PM6/3/20
to Racket Users
`(List* T)` is just `T`. This follows the behavior of the `list*`
function, where `(list* 5)` produces 5.

You can explore this using the `:type` form at the REPL. For example,

```
> (:type (List* String))
String
> (:type (List* String String))
(Pairof String String)
> (:type (List* String (List String)))
(List String String)
```

I've pushed a clarification to the documentation.
> To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/20200603194902.27zjystdhecumoup%40topoi.pooq.com.

Ryan Culpepper

unread,
Jun 3, 2020, 4:23:13 PM6/3/20
to Racket Users
`(List* T)` is the same as `T`, just as `(list* x)` is the same as `x` (whether `x` is a list or not).

  > (require typed/racket)
  > (list* 4 5 6)
  - : (List* Positive-Byte Positive-Byte Positive-Byte)
  '(4 5 . 6)
  > (list* 6)
  - : Integer [more precisely: Positive-Byte]
  6
  > (:type (List* String))
  String

Ryan


Reply all
Reply to author
Forward
0 new messages