0

I am newbie in lisp I have installed Clisp in my ubuntu 14.04 machine and SBCL too.

My Program in TextEditor looks like this:

( hello world )

but i am getting the following error:

 user@user:~/Desktop/lisp$ ./test.lisp
    ./test.lisp: line 1: i: command not found
ojas
  • 2,150
  • 5
  • 22
  • 37
  • 1
    Based on your reported error, you have not included the full file. Please run `cat test.lisp` and paste the full output of that command into your question. – Vatine Sep 05 '15 at 18:33
  • 1
    How did you come up with that test program? `(hello world)` says you want to execute a command `hello` with argument `world`. Lisp doesn't have a built-in `hello` command. You should find a tutorial and follow that. – lurker Sep 05 '15 at 19:36
  • 3
    If you are new to Common Lisp, you probably should have a look at [Common Lisp: A Gentle Introduction to Symbolic Computation](http://www.cs.cmu.edu/%7Edst/LispBook/) (which includes exercises) or [Practical Common Lisp](http://www.gigamonkeys.com/book/) (which gets practical quite early). – Pascal Sep 05 '15 at 19:47

2 Answers2

2

You need to run clisp test.lisp

Anton Malyshev
  • 8,686
  • 2
  • 27
  • 45
2

With CLISP under a unix (like Ubuntu) you can simply add a shebang to the top of your file #!/path/to/clisp and in Ubuntu that would be #!/usr/bin/clisp and it will execute the code as a script.

You need the file to contain proper Common Lisp file like:

#!/usr/bin/clisp
(princ "Hello, world!")

And make the file executable with chmod 755 <filename>. Unless you have placed it in one of the directories in $PATH you'll need to enter the path to it. From the directory of the file simply ./<filename> would suffice.

Sylwester
  • 47,942
  • 4
  • 47
  • 79