equal
deleted
inserted
replaced
21 evaluates it for some arguments. |
21 evaluates it for some arguments. |
22 *} |
22 *} |
23 |
23 |
24 SML_file "factorial.sml" |
24 SML_file "factorial.sml" |
25 |
25 |
26 |
|
27 text {* |
26 text {* |
28 The subsequent example illustrates the use of multiple 'SML_file' |
27 The subsequent example illustrates the use of multiple 'SML_file' |
29 commands to build larger Standard ML projects. The toplevel SML |
28 commands to build larger Standard ML projects. The toplevel SML |
30 environment is enriched cumulatively within the theory context of |
29 environment is enriched cumulatively within the theory context of |
31 Isabelle --- independently of the Isabelle/ML environment. |
30 Isabelle --- independently of the Isabelle/ML environment. |
32 *} |
31 *} |
33 |
32 |
34 SML_file "Example.sig" |
33 SML_file "Example.sig" |
35 SML_file "Example.sml" |
34 SML_file "Example.sml" |
36 |
35 |
|
36 |
|
37 text {* |
|
38 Isabelle/ML and SML share a common run-time system, but the static |
|
39 environments are separate. It is possible to exchange toplevel bindings |
|
40 via separate commands like this. |
|
41 *} |
|
42 |
|
43 SML_export {* val f = factorial *} -- {* re-use factorial from SML environment *} |
|
44 ML {* f 42 *} |
|
45 |
|
46 SML_import {* val println = Output.writeln *} |
|
47 -- {* re-use Isabelle/ML channel for SML *} |
|
48 |
|
49 SML_import {* val par_map = Par_List.map *} |
|
50 -- {* re-use Isabelle/ML parallel list combinator for SML *} |
|
51 |
37 end |
52 end |