Reputation: 1212
There are some forms in the tradition of Scheme that are named the same as more primitive forms but with a *
appended as a suffix.
Some examples
Now for these derived forms the explanation is that you get visibility of your previous bindings
in the later bindings kind of a letrec
style but creating one id at a time instead of all at once (?).
Now this pattern extends thought to other forms and some packages have custom macros with the *
symbol as a suffix (define-ratbag*
). Is this some implicit convention of the Scheme tribe, is this documented somewhere?
Upvotes: 2
Views: 121
Reputation: 10643
There are several things that a *
suffix might mean:
let*
, as opposed to independent scoping like let
. Examples: with-syntax*
is like with-syntax
, but each right-hand side is in the scope of previous clauses.parameterize*
is like parameterize
, but each parameter's new value is evaluated with the previous parameters updated to their new values; with-handlers*
is like with-handlers
, but each exception handler is called in a context with the previous exception handlers installed.remove*
is like remove
, but removes all occurrences of the given element; regexp-match*
is like regexp-match
, but finds all matches.append*
, list*
: (append* vss)
is equivalent to (apply append vss)
.hash-set*
is like hash-set
, but accepts multiple key-value pairs.write-bytes-avail*
is like write-bytes-avail
, except it never blocks; date*
is like date
except it adds nanosecond and time-zone-name fields; call-with-input-file*
is like call-with-input-file
except closes the input port on escapes. In this usage, you can read *
as Scheme/Racket's version of a prime suffix.Upvotes: 9