Platform (OS) detection in scheme

127 views Asked by At

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

2

There are 2 answers

0
Ryan Culpepper On BEST ANSWER

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`
0
gcbenison On

And guile has a uname function, which returns a description as a scheme vector object:

scheme@(guile-user)> (uname)
$2 = #("Linux" "gblaptop" "2.6.39-gentoo-r3" "#4 SMP Fri Oct 21 08:12:17 PDT 2011" "i686")