Search code examples
schemer6rs

Platform (OS) detection in scheme


That must be something like that :

(if (= system-type 'gnu/linux)
    (system "make"))

To be honest I think my scheme implementation even can't do it in anyways but I'm free to add realization for it. What is usual scheme syntax for Platform detection?

thank you


Solution

  • I can't speak for any other Schemes, but Racket has a procedure called system-type:

    > (system-type)
    'unix
    > (system-type 'machine)
    "Linux ... x86_64 GNU/Linux"  ;; ellipses mine, output is same as `uname -a`