From 1c40a971acc00ae1bb292a2634e03807e8b7a3bb Mon Sep 17 00:00:00 2001 From: teo3300 Date: Thu, 21 Dec 2023 19:42:56 +0900 Subject: [PATCH 1/3] Am idiot, forgot to update the files Signed-off-by: teo3300 --- src/main.rs | 2 +- src/parse_tools.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index e1544c2..1624bb5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,7 +8,7 @@ mod mal_tests; mod parse_tools; mod printer; mod reader; -mod step5_tco; +mod step4_if_fn_do; mod types; use core::ns_init; diff --git a/src/parse_tools.rs b/src/parse_tools.rs index 4908ec3..359ad84 100644 --- a/src/parse_tools.rs +++ b/src/parse_tools.rs @@ -1,6 +1,6 @@ use crate::env::Env; use crate::reader::Reader; -use crate::step5_tco::rep; +use crate::step4_if_fn_do::rep; use crate::types::{MalErr, MalRet, MalType::Nil}; use regex::Regex; use std::fs::File; From f2f979b11c01abaacfa6afc87653a35dfc3e776c Mon Sep 17 00:00:00 2001 From: Teo Date: Fri, 21 Mar 2025 12:29:32 +0900 Subject: [PATCH 2/3] Fixed install, fixed typo --- Makefile | 5 +++-- README.md | 4 ++++ src/core.rs | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index c7462aa..2649494 100644 --- a/Makefile +++ b/Makefile @@ -6,9 +6,9 @@ build-release: test: @echo "Test release" - @cargo test --release + @MAL_HOME=core cargo test --release -conf: +conf: test @echo "Copy core and libraries" @mkdir -p ${HOME}/.config/mal cp -f core/core.mal ${HOME}/.config/mal/ @@ -17,6 +17,7 @@ conf: install: build-release test conf @echo "Install mal" + @sudo mkdir -p /usr/local/bin sudo cp target/release/rust-mal /usr/local/bin/mal @sudo chown ${USER} /usr/local/bin/mal @echo "To start mal run:" diff --git a/README.md b/README.md index a739c4d..f4fd5e8 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,7 @@ Trying and implementing [mal](https://github.com/kanaka/mal) project from [kanak ## Why Because I need to improve my knowledge of rust and I also don't know how to use lisp + +## Installation + +Running `make install` should suffice diff --git a/src/core.rs b/src/core.rs index 886cc52..1caa162 100644 --- a/src/core.rs +++ b/src/core.rs @@ -76,7 +76,7 @@ pub fn ns_init() -> Env { "car" => Fun(|a| mal_car(car(a)?), "Returns the first element of the list, NIL if its empty"), "cdr" => Fun(|a| mal_cdr(car(a)?), "Returns all the list but the first element"), // A tribute to PHP's explode (PHP, a language I never used) - "boom" => Fun(mal_boom, "Split a string into a list of string\n; BE CAREFUL WHEN USING"), + "boom" => Fun(mal_boom, "Split a string into a list of chars\n; BE CAREFUL WHEN USING"), "read-string" => Fun(|a| read_str(Reader::new().push(car(a)?.if_string()?)).map_err(MalErr::severe), "Tokenize and read the first argument"), "slurp" => Fun(|a| Ok(Str(read_file(car(a)?.if_string()?)?)), "Read a file and return the content as a string"), "atom" => Fun(|a| Ok(Atom(Rc::new(RefCell::new(car(a).unwrap_or_default().clone())))), "Return an atom pointing to the given arg"), From a173cec94a20fca659a5d51bbbbfd3cb8e060871 Mon Sep 17 00:00:00 2001 From: teo3300 Date: Fri, 21 Mar 2025 12:42:10 +0900 Subject: [PATCH 3/3] Touch history file at install --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 2649494..b8068da 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,7 @@ test: conf: test @echo "Copy core and libraries" @mkdir -p ${HOME}/.config/mal + @touch ${HOME}/.config/mal/.mal-history cp -f core/core.mal ${HOME}/.config/mal/ @mkdir -p ${HOME}/.config/mal/libs cp -f libs/* ${HOME}/.config/mal/libs/