sim_lib_lang_clojure/
profile.rs1use sim_kernel::{Cx, Ref, Result, Symbol};
2use sim_lib_standard_core::{
3 FidelityBadge, LanguageProfile, OrganUse, ProfileBackingLib, ProfileRegistry,
4 install_language_profile,
5};
6
7use crate::{
8 clojure_conformance_test_symbol, clojure_control_fidelity_symbol, clojure_core_profile_symbol,
9 clojure_edn_reader_symbol, clojure_lowering_symbol, clojure_namespace_fidelity_symbol,
10 clojure_sequence_fidelity_symbol,
11};
12
13pub fn clojure_core_profile() -> LanguageProfile {
19 let profile = clojure_core_profile_symbol();
20 let test = clojure_conformance_test_symbol();
21 LanguageProfile::new(profile.clone())
22 .with_reader(clojure_edn_reader_symbol())
23 .with_lowering(clojure_lowering_symbol())
24 .with_eval_policy(Symbol::qualified("eval", "clojure-core"))
25 .with_organ(OrganUse::new(sim_lib_sequence::sequence_organ_symbol()))
26 .with_organ(OrganUse::new(sim_lib_namespace::namespace_organ_symbol()))
27 .with_organ(OrganUse::new(sim_lib_control::control_organ_symbol()))
28 .with_numeric_tower(Symbol::qualified("numbers", "clojure-core"))
29 .with_conformance_test(test.clone())
30 .with_fidelity_badge(FidelityBadge::new(
31 Ref::Symbol(profile.clone()),
32 clojure_sequence_fidelity_symbol(),
33 1,
34 Ref::Symbol(test.clone()),
35 ))
36 .with_fidelity_badge(FidelityBadge::new(
37 Ref::Symbol(profile.clone()),
38 clojure_namespace_fidelity_symbol(),
39 1,
40 Ref::Symbol(test.clone()),
41 ))
42 .with_fidelity_badge(FidelityBadge::new(
43 Ref::Symbol(profile),
44 clojure_control_fidelity_symbol(),
45 1,
46 Ref::Symbol(test),
47 ))
48}
49
50pub fn install_clojure_core_profile(
55 cx: &mut Cx,
56 registry: &mut ProfileRegistry,
57) -> Result<LanguageProfile> {
58 install_language_profile(
59 cx,
60 registry,
61 clojure_core_profile(),
62 &[
63 ProfileBackingLib::loadable(
64 sim_lib_sequence::sequence_organ_symbol(),
65 Symbol::qualified("sim", "sequence"),
66 sim_lib_sequence::install_sequence_lib,
67 Some(sim_lib_sequence::publish_sequence_organ_claims_for_lib),
68 ),
69 ProfileBackingLib::unresolved(
70 sim_lib_namespace::namespace_organ_symbol(),
71 Symbol::qualified("sim", "namespace"),
72 ),
73 ProfileBackingLib::loadable(
74 sim_lib_control::control_organ_symbol(),
75 sim_lib_control::manifest_name(),
76 sim_lib_control::install_control_lib,
77 None,
78 ),
79 ],
80 &[],
81 )
82}