In what order does Scheme code run?
We've been taught various syntax and told how to write开发者_StackOverflow中文版 definitions, but we've never written any code an ran it. What is the order that Scheme code runs in?
Thanks!
The question is a bit vague, but if you're asking about which evaluation strategy scheme uses:
Scheme uses applicative order evaluation.
Edit: Ok, that wasn't what you were asking. So here is the answer to your question as I understand it now:
Scheme code is executed top-to-bottom: I.e. the first expression in the file is executed first, then the one beloew that, then the one below that and so one until the end of file is reached.
So if you have a file containing:
(display "hello ")
(display "world\n")
Then (display "hello ")
is executed first and then (display "world\n")
.
精彩评论