use sim_kernel::{Cx, Ref, Result, Symbol};
use sim_lib_standard_core::{
FidelityBadge, LanguageProfile, OrganUse, ProfileRegistry, install_language_profile,
};
use crate::{
clojure_conformance_test_symbol, clojure_control_fidelity_symbol, clojure_core_profile_symbol,
clojure_edn_reader_symbol, clojure_lowering_symbol, clojure_namespace_fidelity_symbol,
clojure_sequence_fidelity_symbol,
};
pub fn clojure_core_profile() -> LanguageProfile {
let profile = clojure_core_profile_symbol();
let test = clojure_conformance_test_symbol();
LanguageProfile::new(profile.clone())
.with_reader(clojure_edn_reader_symbol())
.with_lowering(clojure_lowering_symbol())
.with_eval_policy(Symbol::qualified("eval", "clojure-core"))
.with_organ(OrganUse::new(sim_lib_sequence::sequence_organ_symbol()))
.with_organ(OrganUse::new(sim_lib_namespace::namespace_organ_symbol()))
.with_organ(OrganUse::new(sim_lib_control::control_organ_symbol()))
.with_numeric_tower(Symbol::qualified("numbers", "clojure-core"))
.with_conformance_test(test.clone())
.with_fidelity_badge(FidelityBadge::new(
Ref::Symbol(profile.clone()),
clojure_sequence_fidelity_symbol(),
1,
Ref::Symbol(test.clone()),
))
.with_fidelity_badge(FidelityBadge::new(
Ref::Symbol(profile.clone()),
clojure_namespace_fidelity_symbol(),
1,
Ref::Symbol(test.clone()),
))
.with_fidelity_badge(FidelityBadge::new(
Ref::Symbol(profile),
clojure_control_fidelity_symbol(),
1,
Ref::Symbol(test),
))
}
pub fn install_clojure_core_profile(
cx: &mut Cx,
registry: &mut ProfileRegistry,
) -> Result<LanguageProfile> {
install_language_profile(
cx,
registry,
clojure_core_profile(),
&[
sim_lib_sequence::publish_sequence_organ_claims_for_lib,
sim_lib_namespace::publish_namespace_organ_claims_for_lib,
sim_lib_control::publish_control_organ_claims_for_lib,
],
)
}