Platform (OS) detection in scheme
Question
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`
OTHER TIPS
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")
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow