How to define subidform

59 Views Asked by At

In racket, we have defsubform for subform, but defsubform does not accept a form like bar but only (bar ...)

1

There are 1 best solutions below

1
On BEST ANSWER

Here's a (cleaned-up) implementation of defsubform

#lang racket

(require scribble/core
         scribble/decode)

(define (into-blockquote s)
  (make-nested-flow (make-style "leftindent" null)
                    (if (splice? s)
                        (decode-flow (splice-run s))
                        (list s))))

(define-syntax (defsubform stx)
  (syntax-case stx ()
    [(_ . rest) #'(into-blockquote (defform . rest))]))

This suggests that you can implement defsubidform as follows:

(define-syntax (defsubidform stx)
  (syntax-case stx ()
    [(_ . rest) #'(into-blockquote (defidform . rest))]))