2
라켓 파일 foo.rkt가 있습니다. 그 파일 안에 textify라는 프로 시저가 있으며 2 개의 매개 변수가 필요합니다. 이제 터미널에서이 절차를 어떻게 호출 할 수 있습니까?커맨드 라인 argumands를주는 방법으로 터미널에서 라켓 절차를 호출하는 방법
> racket foo.rkt myfirstarg mysecondarg
후 나는이 호출이 (textify myfirstarg mysecondarg)
절차를 활성화하려면 : 내가하고 싶은 간단하다. 이것이 가능한가 ?
(apply textify (vector->list (current-command-line-arguments)))
것은 당신이 가지고있는 고급 프로그램을 제작하는 경우 :
#lang racket
(require wxme)
(provide
(contract-out
[textify (-> path-string? path-string? void?)]))
(define (textify in out)
(call-with-input-file in
(λ (in-port)
(call-with-output-file out
(λ (out-port)
(copy-port (wxme-port->text-port in-port) out-port))
#:exists 'truncate))))