Join our network of non-profits, companies and individuals who believe social change can happen through design.

Become A Member
avatar

Sarah Houston

United States

Member since October 25, 2012

I put in gcl and clisp via yum in Fedora eight. Both equally seem to be standard offers in the Fedora distribution. Lisp is neat and wonderful. There are some difficulties (as you can expect to see beneath) in finding various implementations to operate, and there seem to be to be a plethora of considerably incompatible (or non-moveable?) Lisp deals.

gcl is the GNU prevalent lisp compiler and interpreter. It can interpret code, and it can compile to binary executables.

clisp is a widespread lisp interpreter. It is effortless to use, but does not compile to binary executables.

gcl utilizes an internal Lisp operate to magically make an executable. The method supposedly includes compile Lisp to Do, compile the Do an object file,website link the object with some obscure libraries via an obscure approach. I was not in a position to find a command to stock options compile the C code with gcc, nor was I capable to find the destinations of the url libraries (object libraries), and examples command lines for ld.

You can make a .o file by utilizing -compile. You can make a .c file by making use of -do-file. You can make a .h file by making use of -h-file. Nonetheless, I acquired backlink glitches when I tried to compile the .do with gcc. I gave up and utilized the magic Lisp operate. Far more on that beneath.

The executables are large. On my device "hello there planet" was 14MB. The very same binary created from a Do "hi entire world" source file was 4KB. Granted, Lisp must consist of a entire interpreter in each and every Lisp software, just in scenario the code uses macros or some other code-generated-on-the-fly characteristic.

Make a file cl_hw.lisp

(princ "hellow trading options earth!")

Run this command

clisp cl_hw.lisp

Or you can run this command to use gcl as an interpreter

gcl -batch -load cl_hw.lisp

-batch implies "runs gcl with out printing the copyright discover, and do not enter the command line eval-print loop".

-load signifies "run the Lisp code". There is a special Lisp operate to compile and link an object file with the Lisp object library. Additional on that beneath. You do not need to have to use -compile to make an executable. You might optionally use -compile. You *should* use -load and (systemsave-program).

Proper absent you'll notice that Lisp looks to be missing newline characters. I get the impact that there are no standard bindings for manage characters in Lisp. I am sure there is some straightforward way to cope with control chars, but I am spoiled by Perl (and C) the place n is portable future and options for newline (it will work on all operating devices), and Perl has string interpolation.Aspect of the Lisp answer is to use (format) and probably the % and connected macros. The % does not perform in clisp.

The gcl hi word illustration is strange, and the writer failed to reveal why the weirdness. As you can see above, a easy example functions great. Nonetheless, the easy case in point can not be compiled to an executable. The only (considerably) documented approach to get an executable is to use a Lisp functionality (systemsave-program).

File hello1.lisp

(defun sitop-degree ()

(format t "howdy planet!%" )

)

(systemsave-process "hello there")

Develop an executable

gcl -batch -load hello1.lisp

The identify of the exe is challenging coded in the script to be "hello there". Right here is a session transcript

zeus clisp$ cat hello1.lisp

(defun sitop-level ()

(format t "hello there earth!%" )

)

(systemsave-system "howdy")

zeus clisp$

zeus how options work clisp$ gcl -batch -load hello1.lispzeus clisp$ lltotal 13864-rwxrwxr-x one mst3k mst3k 14132764 2008-08-eleven 1028 howdy-rw-rw-r-- 1 mst3k mst3k90 2008-08-eleven 1025 hello1.lisp-rw-rw-r-- 1 mst3k mst3k332 2008-08-11 1021 hello1.lispzeus clisp$ ./hellohello world!zeus clisp$

gcl wants to know the name of the perform that will be most important() in the Do code. This is sitop-degree() and by making use of (defun) we have defined this operate. We can (defun most important() ...) but we have to use a lot more system calls, and we have to add a (stop) to our (defun). Even worse, after this is accomplished, I cannot discover a way to protect against the GNU license communication from printing. Observe in the examples over that the gcl license did not print, but in the upcoming instance, the license *does* print. Heaven only is aware of why.

The session transcript. I use share options "cat" so you can see the contents of hello2.lisp. I also experimented with ./hi there -batch, to no avail. The license failed to print, but neither did my output.

zeus clisp$ cat hello2.lisp(defun principal ()(format t "hi planet!%" )(stop))(setf program*best-level-hook* 'main)(systemsave-system "hello2")zeus clisp$ gcl -batch -load hello2.lispzeus clisp$ ls -l hello2*-rwxrwxr-x 1 mst3k mst3k 14132764 2008-08-11 1043 hello2-rw-rw-r-- 1 mst3k mst3k131 2008-08-11 1040 hello2.lisp-rw-rw-r-- one mst3k mst3k332 2008-08-eleven 1022 hello2.lispzeus clisp$ ./hello2GCL (GNU Common Lisp)2.six.7 ANSIAug 14 2007 173505Source License LGPL(gcl,gmp), GPL(unexec,bfd)Binary LicenseGPL because of to GPL'ed parts (READLINE BFD UNEXEC)Modifications of this banner need to keep detect of a compatible licenseDedicated to the memory of W. SchelterUse (help) to get some fundamental details on how to use GCL.hi there globe!zeus clisp$ ./hello2 -batchzeus clisp$

You may find more information at these web-sites

http//en.wikibooks.org/wiki/Widespread_Lisp

http//clisp.disadvantages.org/impnotes/quickstart.html

about JannaWhitfield1933

Contact Sarah Houston

My Interests

  • Industrial Design
  • Environmental Design
  • Communication Design
  • Fashion Design
  • Audio/Visual Design