diff --git a/lib/src/metta/runner/stdlib/stdlib.metta b/lib/src/metta/runner/stdlib/stdlib.metta index 43fe597e4..aa364322a 100644 --- a/lib/src/metta/runner/stdlib/stdlib.metta +++ b/lib/src/metta/runner/stdlib/stdlib.metta @@ -816,7 +816,7 @@ (@doc-formal (@item $atom) (@kind atom) (@type $type) (@desc "No documentation")) ))))) (@doc help! - (@desc "Function prints documentation for the input atom.") + (@desc "Function prints documentation for the input atom. Without parameters prints the list of the stdlib functions.") (@params ( (@param "Input to get documentation for"))) (@return "Unit atom")) @@ -839,6 +839,16 @@ () )) ($other (Error $other "Cannot match @doc-formal structure") )))) +(: help! (-> (->))) +(= (help!) (let $top-space (mod-space! top) + (unify $top-space (@doc $name (@desc $desc) $params $ret) + (let () (println! (format-args "{}\n\t{}" ($name $desc))) Empty) + Empty))) +(= (help!) (let $top-space (mod-space! top) + (unify $top-space (@doc $name (@desc $desc)) + (let () (println! (format-args "{}\n\t{}" ($name $desc))) Empty) + Empty))) + (@doc help-param! (@desc "Function used by function help! to output parameters using println!") (@params ( diff --git a/repl/src/main.rs b/repl/src/main.rs index 4a9b28a6c..06615adfd 100644 --- a/repl/src/main.rs +++ b/repl/src/main.rs @@ -93,6 +93,11 @@ fn main() -> Result<()> { } } +fn show_welcome_message() { + println!("Visit https://metta-lang.dev/ for tutorials."); + println!("Execute !(help!) to get list of the standard library functions."); +} + // To debug rustyline: // RUST_LOG=rustyline=debug cargo run --example example 2> debug.log fn start_interactive_mode(repl_params: ReplParams, mut metta: MettaShim) -> rustyline::Result<()> { @@ -137,6 +142,8 @@ fn start_interactive_mode(repl_params: ReplParams, mut metta: MettaShim) -> rust } } + show_welcome_message(); + //The Interpreter Loop loop {