1
1
mirror of https://github.com/kanaka/mal.git synced 2024-08-16 17:20:23 +03:00

Merge remote-tracking branch 'remotes/kanaka/master' into improve-mal-impl-macro-no-meta

This commit is contained in:
Nicolas Boulenguez 2019-07-15 19:49:33 +02:00
commit 4733821090
5 changed files with 19 additions and 5 deletions

View File

@ -115,8 +115,8 @@ $core_ns = @{
"pr-str" = { pr_seq $args $true " " };
"str" = { pr_seq $args $false "" };
"prn" = { Write-Host (pr_seq $args $true " ") };
"println" = { Write-Host (pr_seq $args $false " ") };
"prn" = { Write-Host (pr_seq $args $true " "); $null };
"println" = { Write-Host (pr_seq $args $false " "); $null };
"read-string" = { read_str $args[0] };
"readline" = { Write-Host $args[0] -NoNewline; [Console]::Readline() };
"slurp" = { Get-Content -Path $args[0] -Raw };

View File

@ -2,6 +2,10 @@ SOURCES_BASE = readline.r types.r reader.r printer.r
SOURCES_LISP = env.r core.r stepA_mal.r
SOURCES = $(SOURCES_BASE) $(SOURCES_LISP)
STEPS = step0_repl.r step1_read_print.r step2_eval.r step3_env.r \
step4_if_fn_do.r step5_tco.r step6_file.r \
step7_quote.r step8_macros.r step9_try.r stepA_mal.r
all: libs
dist: mal.r mal
@ -14,8 +18,7 @@ mal: mal.r
cat $< >> $@
chmod +x $@
clean:
rm -f mal.r mal
$(STEPS): libs
.PHONY:
libs: lib/rdyncall
@ -25,3 +28,8 @@ lib/rdyncall:
mkdir -p lib
R CMD INSTALL rdyncall_0.7.5.tar.gz -l lib/
rm rdyncall_0.7.5.tar.gz
clean:
rm -f mal.r mal

View File

@ -99,7 +99,7 @@ mal_readline: procedure expose values. /* mal_readline(prompt) */
return new_nil()
mal_slurp: procedure expose values. /* mal_read_string(filename) */
file_content = charin(obj_val(arg(1)), , 100000)
file_content = charin(obj_val(arg(1)), 1, 100000)
return new_string(file_content)
mal_lt: procedure expose values. /* mal_lt(a, b) */

View File

@ -127,6 +127,8 @@
;=>false
(= (list) 0)
;=>false
(= (list nil) (list))
;=>false
;; Testing builtin and user defined functions

View File

@ -25,6 +25,10 @@
(slurp "../tests/test.txt")
;=>"A line of text\n"
;;; Load the same file twice.
(slurp "../tests/test.txt")
;=>"A line of text\n"
;; Testing load-file
(load-file "../tests/inc.mal")