문제

Racket guide introduces functions with keyword arguments:

(define (F #:keyword argument) ...)

When we use it, we need to associate certain value with the argument:

(F #:keyword 'value)

But in the same guide there is an example of keyword argument with no value:

(struct posn (x y)
    #:transparent)

Is it possible to create such flag-like arguments for programmers, or it is clearly internal feature?

도움이 되었습니까?

해결책

struct is not a function, it is a macro. You can define your own macros that uses keywords in the same way.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top