0

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

林子篆
  • 84
  • 1
  • 4

1 Answers1

2

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))]))
Sorawee Porncharoenwase
  • 6,305
  • 1
  • 14
  • 28