I am familiar with python before and now I am trying to learn common lisp and using ccl(clozure common lisp)under windows system.
I found that there is not a convenient way to run lisp file as python. So i write a bat file to compile and run a lisp file.
@echo off
set lisp_filename=%~1
set ccl_path=D:\_play_\lispbox-0.7\ccl-1.6-windowsx86\wx86cl.exe
IF "%PROCESSOR_ARCHITECTURE%" == "x86" (
set fsl_filename=%lisp_filename:.lisp=.wx32fsl%
) ELSE (
set ccl_path=%ccl_path:wx86cl=wx86cl64%
set fsl_filename=%lisp_filename:.lisp=.wx64fsl%
)
IF NOT EXIST %fsl_filename% goto compile
for %%a in ("%lisp_filename%") do (
set lisp_timestamp=%%~ta
)
for %%a in ("%fsl_filename%") do (
set fsl_timestamp=%%~ta
)
IF "%fsl_timestamp%" LSS "%lisp_timestamp%" (
goto compile
) ELSE (
goto run
)
:compile
REM echo "compile"
%ccl_path% --eval "(progn (compile-file \"%lisp_filename:\=\\%\") (ccl:quit))"
:run
REM echo "run"
%ccl_path% --eval "(progn (load \"%fsl_filename:\=\\%\") (ccl:quit))"
:end
Everything goes well, but I can not found anway to pass the command line arguments into the lisp script.
I tried a script(test.lisp) like this
(defun main()
(format t "~{~a~%~}" *command-line-argument-list*)
0 ) (main)
But the result is
D:\_play_\lispbox-0.7\ccl-1.6-windowsx86\wx86cl64.exe
--eval
(progn (load "D:\\_play_\\test.wx64fsl") (ccl:quit))
I know this output is as the result of my bat file, but I can't find an elegant way to pass the command line argument into a lisp script, neither.
Can anyone tell me more things about how can I pass the arguments?
I wish the best answer can implement something like:
test.lisp a b c
and with a output
test.lisp
a
b
c
Any suggestion is very appreciated. :-)