Arc Forumnew | comments | leaders | submitlogin
How to use Racket keyword args in Arc?
3 points by hjek 2597 days ago | 1 comment
Hi,

Can anyone tell me why this works in Racket,

    (require net/smtp)
    (smtp-send-message "smtp.example.com" "test@example.com" "test@example.com"  "hello" '("hello world") #:auth-passwd "secretpassword" #:auth-user "test@example.com")
whereas this fails in Arc,

    ($ (require net/smtp))
    ($ (smtp-send-message "smtp.example.com" "test@example.com" "test@example.com"  "hello" '("hello world") #:auth-passwd "secretpassword" #:auth-user "test@example.com"))
with this error,

    smtp-send-message: arity mismatch
    expected: a different number plus optional arguments with keywords #:auth-passwd, #:auth-user, #:port-no, #:tcp-connect, and #:tls-encode
    given: 9
    arguments...
    [...]
Or why `keyword-apply` is bound in Racket but `$.keyword-apply` isn't in Arc?

It should be possible to use Racket keyword args from Arc; at least according to this, https://github.com/hubski/hubski/wiki/Converting-Arc-functions-to-Racket



3 points by hjek 2596 days ago | link

I figured it out. Arc uses `lambda` from Mzscheme, and that version of `lambda` doesn't support keyword args. Trying to import Racket's `lambda` caused a conflict with the other `lambda`, so in the end I imported Racket's `keyword-apply` to do the job.

I have committed this code to the Anarki repo, so now everyone can use Racket keywords in their Arc programs. Yay!

-----