-
14
pages
-
English
-
Documents
Description
1Name: SOLUTION KEYCSCI-4430 Programming LanguagesFinal Exam, Part I1 Thread ExpressionsOz provides thread expressions as syntactic sugar for its kernel languagethread statement. The following code is the kernel language version of asingle thread expression.local R1 R2 inthread local A in A=N-1 {Fib A R1} end endthread local B in B=N-2 {Fib B R2} end end{Number.´+´ R1 R2 R}endWrite that thread expression (in as simple a form as you can).2 ptsAnswer:thread {Fib N-1} end + thread {Fib N-2} end2 Producer/Consumer Stream ProgrammingThe following code is the same as the Sieve of Eratothenes example (theoriginal, unoptimized version) discussed in the textbook and one of thelabs, except that the Sieve function is expressed as a procedure insteadof a function.fun {Generate N Limit}if N
-
Publié par
-
Langue
English