NEW assignment(pls let me know someone do this)
Turn your lab4 into a program that you can run off of the command line. Basically, you need to be able to run it something like this:
and have it do its thing... command line arguments and the whole bit are possibilities. I recommend that you do it thus:
Compile your [url removed, login to view] and any other helper files. See the COMPILE-FILE function.
Start up your Lisp, and from the top level, load your [url removed, login to view] and any helpers.
Create a new function that will start your application if you don't already have one, something like RUN-LAB5 that, when evaluated, will make sure everything happens properly.
Dump a memory image of your Lisp. For CMUCL, see the function EXTENSIONS:SAVE-LISP for details. The Web documentation of CMUCL describes the function in detail. [url removed, login to view] Be sure that when you invoke EXTENSIONS:SAVE-LISP that you specify your :init-function... RUN-LAB5 would be appropriate. :-) For CLISP, which I recommend, look at EXT::SAVEINITMEM.
Write a shell script called lab5 that will start up your Lisp with the right options. Something like this would be good:
/usr/contrib/bin/clisp -q [url removed, login to view]
After you have a lab5 shell script with the code above, you need to change the permissions. chmod 755 lab5
that's the assignment. and you can find the lab 4 under this....
; In this lab, I tried to implement some Matrix Operations,
; These are the only matrix operations that I remember from
; the freshman year.
; The code will print out the row count
(defun matrix-rows (matrix)
; The code will print out the column count
(defun matrix-columns (matrix)
(length (first matrix)))
; Zero Matrix (A x B)
; This function will crate matrixes full of zeros,
; depends on the input (A x B)
(defun zero-matrix (m n)
(let ((result nil))
(dotimes (i m)
(push (make-list n :initial-element 0) result))
; Multiplication of Two Matrixes
; The function will print out
; I preferred flet instead of let because flet makes let like binding
; instead of variables. Otherwise, it returns illegal veriable error.
(defun mul-matrix (a b)
(flet ((col (mat i) (mapcar #'(lambda (row) (elt row i)) mat))
(row (mat i) (elt mat i)))
(loop for row from 0 below (length a)
collect (loop for col from 0 below (length (row b 0))
collect (apply #'+ (mapcar #'* (row a row) (col b col)))))))
; Merging Two Macrices
; Number of Rows must be equal to be able to merge them,
; thus, the code will check rows of the matrices.
; If they are not equal, an error code will show up.
; Otherwise, the program will run.
(defun merge-matrix (matrix-1 matrix-2)
(if (not (or (eql (matrix-rows matrix-1) (matrix-rows matrix-2)) (null matrix-1) (null matrix-2))) (error "Invalid dimensions."))
((null matrix-1) (copy-tree matrix-2))
((null matrix-2) (copy-tree matrix-1))
(t (let ((result (copy-tree matrix-1)))
(dotimes (i (matrix-rows matrix-1))
(setf (nth i result) (nconc (nth i result) (nth i matrix-2))))
The Language will be in Common Lisp - CLISP...
I am going to attach the assignment... and What I submitted for lab4 ... I'm also going to attach lab4 assignment so you can get the idea..It's in word format..
By the way, I don't want something so fancy. Just the requirements... ok...
i can pay 20$