I am writing a simple script using Racket and I want to pass in three values from the command line. Two floats and an integer.
My initial thought was to try this:
(define args (current-command-line-arguments))
(define c (string->number(car args)))
but that did not work as expected. I received this error:
car: contract violation
expected: pair?
given: '#("3" "2")
I'm new to Racket, but I think the the #
means procedure rather than list. I just need a list of the arguments.
I found some documentation on parsing command line args from Racket, but it seems to be designed to parse for switches/options rather than just values.
Can anyone offer any advice? thanks.
command-line
macro that you linked to does let you specify the number of arguments with#:args
(saves you some code to check that). You're correct that you still have to check/parse the individual arguments yourself though. – Asumu Takikawa