[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ?-suffix for booleans... good-idea? or bad-idea?

From: szgyg
Subject: Re: ?-suffix for booleans... good-idea? or bad-idea?
Date: Fri, 5 May 2017 21:44:12 +0200
User-agent: Mutt/1.6.0 (2016-04-01)

On Fri, May 05, 2017 at 08:26:03PM +0300, Vladimir Zhbanov wrote:
> ? could be a prefix for booleans in contrast with predicates:
> (define ?red-x (red? x))
> ...
> (if (red? x) 'a 'b)
> ...
> (if ?red-x 'a 'b)

?foo is used for macro template variables.

(define-syntax begin1
  (syntax-rules ()
    ((_ ?first ?body ...)
     (let ((tmp ?first)) ?body ... tmp))))

With this convention it's clear that ?first and ?body will be replaced,
while let and tmp will appear literally in the expanded macro.

For macro-generating macros we can also use ??foo

(define-syntax-rule (create-useless-macro ?name)
  (define-syntax-rule (?name ??param)
    (display '(?name ??param))))

(create-useless-macro foo)
(define-syntax-rule (foo ??param)
  (display '(foo ??param)))

(foo bar)
(display '(foo bar))

This convention is used in SRFI-46[0] for example.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]