[scribble] Are nested lists possible?

61 views
Skip to first unread message

David Storrs

unread,
Oct 13, 2020, 12:45:59 PM10/13/20
to Racket Users
@itemlist[
  @item{The size cage needed depends on the type of dog
  @itemlist[
    @item{Pug:  Small}
    @item{Collie: Medium}
    @item{Mastiff:  Large}]}
]

I would like to produce something that looks like this:
  • The size cage needed depends on the type of dog
    • Pug: Small
    • Collie: Medium
    • Mastiff: Large
Is there a correct way to do this?

Ben Greenman

unread,
Oct 13, 2020, 12:48:13 PM10/13/20
to Racket Users
On 10/13/20, David Storrs <david....@gmail.com> wrote:
> @itemlist[
> @item{The size cage needed depends on the type of dog
> @itemlist[
> @item{Pug: Small}
> @item{Collie: Medium}
> @item{Mastiff: Large}]}]
>
> I would like to produce something that looks like this:
>
> - The size cage needed depends on the type of dog
> - Pug: Small
> - Collie: Medium
> - Mastiff: Large
>
> Is there a correct way to do this?

What you have looks good to me in #lang scribble/manual
Screen Shot 2020-10-13 at 12.51.02.png

David Storrs

unread,
Oct 13, 2020, 12:58:12 PM10/13/20
to Racket Users
Here's the actual code:

@defproc[(trie-add-item+data! [arg trie?][item (listof any/c)][#:combine combine-method (or/c 'keep 'replace 'meld/current 'meld/new (-> trie-node? trie-node? trie-node?)) 'meld/new]) trie?]{Adds one item to the trie where the elements of the list are considered to be elements of the item.  If an item is a @racket[cons] pair where the @racket[cdr] is a @racket[trie-node?] then the @racket[car] will be used as the element and the @racket[cdr] will be the data attached to that node.  The final node is marked as terminal regardless of whether it already existed.

If an element of the item already exists in the trie then that element will be updated based on the combine method specified via the @racket[#:combine] keyword.  Specifically:

@itemlist[
@item{test}
]
}

Here's the error output:

trie.scrbl:165:0: item: misuse of an identifier (not in `racket', etc.) that is bound as a code-typesetting variable
  in: (item "test")
  location...:
   trie.scrbl:165:0
  context...:
   do-raise-syntax-error
   apply-transformer-in-context
   apply-transformer
   dispatch-transformer
   for-loop
   [repeats 2 more times]
   finish-bodys
   lambda-clause-expander
   for-loop
   [repeats 1 more time]
   finish-bodys
   for-loop
   finish-bodys
   loop
   for-loop
   [repeats 3 more times]


It works fine if I remove the inner @itemlist.  What should I do differently?

--
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/CAFUu9R4-4BO3Gi2PDxZ%3D2BbQCrJP4O%2BkAWT1f7DJJtFapFdYTA%40mail.gmail.com.

David Storrs

unread,
Oct 13, 2020, 1:02:55 PM10/13/20
to Racket Users
Argh.  Wrong code.  Please ignore prior message.

David Storrs

unread,
Oct 13, 2020, 1:09:01 PM10/13/20
to Racket Users
Okay, apparently it doesn't like having an itemlist inside of a {} block at all, but as long as it's outside of one then nested lists are fine.  Ugh.  I know Scribble is super good because it makes beautiful documentation and does cross-linking and examples and all that, but it's also a complete pain in the ass unless you're expert with it.

Sorry for wasting everyone's time.

Sorawee Porncharoenwase

unread,
Oct 13, 2020, 1:20:44 PM10/13/20
to David Storrs, Racket Users

apparently it doesn’t like having an itemlist inside of a {} block at all

I’m not sure if I totally understand it, but this doesn’t appear to be true. The below doc renders correctly as I expect.

#lang scribble/manual

@itemlist[
  @item{foo
        @itemlist[
          @item{bar}
          @item{baz}]
        hello
        @itemlist[
          @item{world}]}
 @item{foo2
        @itemlist[
          @item{bar2}
          @item{baz2}]
        hello2
        @itemlist[
          @item{world2}]}]

William J. Bowman

unread,
Oct 13, 2020, 6:52:37 PM10/13/20
to David Storrs, Racket Users
> >>> @defproc[(trie-add-item+data! [arg trie?][item (listof any/c)][#:combine
Is the issue that you rebound `item`?
> > https://groups.google.com/d/msgid/racket-users/CAE8gKocp9RQ0cV1OL1dAAH%2B4CevDVTfHvd8Xf5o%3DP5KGeUZwjg%40mail.gmail.com
> > <https://groups.google.com/d/msgid/racket-users/CAE8gKocp9RQ0cV1OL1dAAH%2B4CevDVTfHvd8Xf5o%3DP5KGeUZwjg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> > .
> >
>
> --
> 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/CADcuegs-94OYHQi9JMx%2BsdqQdA2RM_Fg2sCLRxYQdLycJsvjcQ%40mail.gmail.com.

David Storrs

unread,
Oct 13, 2020, 8:01:23 PM10/13/20
to Racket Users
On Tue, Oct 13, 2020 at 6:52 PM William J. Bowman <w...@williamjbowman.com> wrote:
> >>> @defproc[(trie-add-item+data! [arg trie?][item (listof any/c)][#:combine
Is the issue that you rebound `item`?


...

Yes.  Yes, that is exactly the issue.  I hate my life.

Thank you.
Reply all
Reply to author
Forward
0 new messages