문제

Forgive my ignorance, but what is the difference between these two:

(define blah)
(define* blah)

? Unfortunately Google ignores the asterisks character.

도움이 되었습니까?

해결책

SRFI 89 was written by Gambit's author, so it's only fair to assume that Gambit's define* does what that document says. :-)

In other words, it's syntactic sugar over lambda* (as described in SRFI 89) rather than lambda.

다른 팁

In the (rather extensive) documentation of Gambit Scheme there is no mention of a define* special form; it might be some procedure, definition, macro or special form found only in the piece of code where you saw it. You should post a link referencing the source of the code where define* is being used.

A little more context for the question would be nice.

Sometimes the * just means that the form does something extra. My guess is therefore that define* works as ordinary define, but at the same time does something extra. This extra could be automatically exporting the name from a module.

This definition was found in the Racket ffi-lib illustrates this principle:

(define-syntax define*
  (syntax-rules ()
    [(_ (name . args) body ...)
     (begin (provide name) (define (name . args) body ...))]
    [(_ name expr)
     (begin (provide name) (define name expr))]))
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top