Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Racket function flag arguments

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?

like image 735
Strider Avatar asked Feb 26 '26 11:02

Strider


1 Answers

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

like image 169
soegaard Avatar answered Feb 27 '26 23:02

soegaard