pub fn new(
        kb: Arc<RwLock<KnowledgeBase>>,
        tracing: bool,
        goals: Goals,
        messages: MessageQueue,
    ) -> Self {
        let constants = kb
            .read()
            .expect("cannot acquire KB read lock")
            .constants
            .clone();
        let mut vm = Self {
            goals: GoalStack::new_reversed(goals),
            binding_manager: BindingManager::new(),
            query_start_time: None,
            query_timeout: QUERY_TIMEOUT_S,
            stack_limit: MAX_STACK_SIZE,
            csp: Bsp::default(),
            choices: vec![],
            queries: vec![],
            tracing,
            trace_stack: vec![],
            trace: vec![],
            external_error: None,
            debugger: Debugger::default(),
            kb,
            call_id_symbols: HashMap::new(),
            log: std::env::var("RUST_LOG").is_ok(),
            polar_log: std::env::var("POLAR_LOG").is_ok(),
            polar_log_stderr: std::env::var("POLAR_LOG")
                .map(|pl| pl == "now")
                .unwrap_or(false),
            polar_log_mute: false,
            query_contains_partial: false,
            inverting: false,
            messages,
        };
        vm.bind_constants(constants);
        vm.query_contains_partial();
        vm
    }
/// Make a new virtual machine with an initial list of goals.
/// Reverse the goal list for the sanity of callers.
Make a new virtual machine with an initial list of goals.
Reverse the goal list for the sanity of callers.
Make a new virtual machine with an initial list of goals . Reverse the goal list for the sanity of callers .
pub fn new(
        kb: Arc<RwLock<KnowledgeBase>>,
        tracing: bool,
        goals: Goals,
        messages: MessageQueue,
    ) -> Self {
        let constants = kb
            .read()
            .expect("cannot acquire KB read lock")
            .constants
            .clone();
        let mut vm = Self {
            goals: GoalStack::new_reversed(goals),
            binding_manager: BindingManager::new(),
            query_start_time: None,
            query_timeout: QUERY_TIMEOUT_S,
            stack_limit: MAX_STACK_SIZE,
            csp: Bsp::default(),
            choices: vec![],
            queries: vec![],
            tracing,
            trace_stack: vec![],
            trace: vec![],
            external_error: None,
            debugger: Debugger::default(),
            kb,
            call_id_symbols: HashMap::new(),
            log: std::env::var("RUST_LOG").is_ok(),
            polar_log: std::env::var("POLAR_LOG").is_ok(),
            polar_log_stderr: std::env::var("POLAR_LOG")
                .map(|pl| pl == "now")
                .unwrap_or(false),
            polar_log_mute: false,
            query_contains_partial: false,
            inverting: false,
            messages,
        };
        vm.bind_constants(constants);
        vm.query_contains_partial();
        vm
    }
pub fn new ( kb : Arc < RwLock < KnowledgeBase > > , tracing : bool , goals : Goals , messages : MessageQueue , ) -> Self { let constants = kb . read ( ) . expect ( " " ) . constants . clone ( ) ; let mut vm = Self { goals : GoalStack :: new_reversed ( goals ) , binding_manager : BindingManager :: new ( ) , query_start_time : None , query_timeout : QUERY_TIMEOUT_S , stack_limit : MAX_STACK_SIZE , csp : Bsp :: default ( ) , choices : vec ! [ ] , queries : vec ! [ ] , tracing , trace_stack : vec ! [ ] , trace : vec ! [ ] , external_error : None , debugger : Debugger :: default ( ) , kb , call_id_symbols : HashMap :: new ( ) , log : std :: env :: var ( " " ) . is_ok ( ) , polar_log : std :: env :: var ( " " ) . is_ok ( ) , polar_log_stderr : std :: env :: var ( " " ) . map ( | pl | pl == " " ) . unwrap_or ( false ) , polar_log_mute : false , query_contains_partial : false , inverting : false , messages , } ; vm . bind_constants ( constants ) ; vm . query_contains_partial ( ) ; vm }
Make a new virtual machine with an initial list of goals.
Make a new virtual machine with an initial list of goals .
kb
Arc<RwLock<KnowledgeBase>>
tracing
bool
goals
Goals
messages
MessageQueue