You can use it with keyword-apply
(define (foo #:x x) (+ x 3))
(keyword-apply foo (list (string->keyword "x")) (list 8) '())
;; ==> 11
http://docs.racket-lang.org/reference/procedures.html#%28def._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._keyword-apply%29%29
On Mon, Jan 9, 2017 at 12:47 PM,
What should string->keyword be used for? I was expecting this to work
but it does not:
(define (foo #:x x) (+ x 3))
(foo (string->keyword "x") 8)
; foo: arity mismatch;
; the expected number of arguments does not match the given number
; expected: 0 plus an argument with keyword #:x
;
2 matches
Mail list logo