Difference between define and define*

206 views Asked by At

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

(define blah)
(define* blah)

? Unfortunately Google ignores the asterisks character.

3

There are 3 answers

0
C. K. Young On BEST ANSWER

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.

0
Óscar López On

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.

0
soegaard On

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))]))