LISP Homework Help, Project Help, LISP Assignment Solution

Welcome, you’ve found the best place if you require help with Lisp assignments. We guarantee that the work will be completed, or we will give you a complete refund.

Lisp is an old programming language, that concerns processing of lists. It is very different than C++, there is very little to distinguish data and code.

We provide Lisp assignment help with unique explanation of the Lisp programming concepts.  This is our accountability and responsibility to provide Lisp homework help to students in the best possible ways. Our Lisp online tutors provide unmatched assistance in Lisp programming. Common lisp provides a number of features to develop your Lisp program interactively and incrementally. And hence the common Lisp becomes one of the best languages for exploratory programming.

LISP is the abbreviation for List Programming. Shortly after the development of FORTRAN, John McCarthy invented LISP in 1958. ProgrammingHomeworkHelp provides assignment solutions on LISP programming as well as LISP programming homework help. The first implementation of LISP was on an IBM 704 computer done by Steve Russell. As it processes the symbolic information efficiently, it is particularly suitable for Artificial Intelligence programs. Experts in LISP programming homework help the students to learn about the common LISP that originated during 1980 to 1990, to unite the work of several implementation groups, like successor of Maclisp like ZetaLisp and the new implementation of LISP (NIL) etc. It serves as a common language; can easily extend for specific implementation. Programs do not depend on machine-specific characteristics written in Common LISP, such as word length etc.

If you need a Lisp tutor to help with Lisp programming assignments like this, you’re welcome tofeel free to} Contact us.

Lisp Function and Programming Questions

  1. Define a function ADD-LENGTH-TO-LIST, whose argument is a list.
    This function should insert the length of the list into the end of the list.

Answer:

(defun ADD-LENGTH-TO-LIST (l) (nconc l (list (length l))))

2. Loss and gain of not including C++ pointers and use references in Java.

Answer:

References in Java have less flexibility than pointers in C++. With dynamic runtime typecase in C++, pointers provide much flexibility to access data which is more convenient. However, the references in Java provides more security protection. For example, even functions or fields are declared as private in C++, we can still visit them by manipulating the pointers to the objects. It is impossible to do the same thing in Java.

3. How coercion rules can weaken the beneficial effects of strong typing.

Answer:

Compilers for strong typing languages usually can detect more typing related errors during the compile time. Compared to that, coercion rules
make the language less compile time reliable. In addition, it is considered easier for people to understand codes written in strong typing languages since coercion rules usually adds some logic implicitly behind the code itself.

Guaranteed 100% plagiarism free answers to your Lisp course work. So, if you are looking for a Lisp online tutor or just Lisp problem solutions then look no further.

We offer LISP programming assignment help services, and our experts provide solutions for LISP assignments related to explaining the features like its machine-independency, iterative design methodology, easy extensibility, allowing dynamically updating the programs. It also provides high level debugging, advanced object-oriented programming and convenient macro system. Wide-range data types like lists, objects, vectors, structures, hash-tables, adjustable arrays and symbols are expression-based. It also incorporates object-oriented condition systems that provide complete I/O library and extensive control structures.

Our services in Lisp project help encompasses all the topics on Lisp programming. The standards of our Lisp programming solutions is sufficient for all the levels in academics like school, college, masters or PhD levels. Our solutions in Lisp programming even satisfy the assignment need of working professionals.

Tic Tac Toe game using LISP.

The program should ask the user at the beginning to choose EASY or DIFFICULT, which are the two levels of difficulty of playing against the computer.

EASY – should be easier to win the computer.

DIFFICULT – computer should win most of times.

Solution:

;;; TIC-TAC-TOE
;;
;; define a 2 players game, identify player behaviour as
;;  1) user choose on keyboard
;;  2) computer - play easy (select first available)
;;  3) random   - peek any valid
;;  4) computer - play best (minimax search of game tree)
;;
;; the board is represented by a 9 elements list, each element
;; can be either 'x, 'o, or '-
;;

;; printing a board' state
;;
(defun print-row (row)
  (format t "~a ~a ~a ~%" (car row) (cadr row) (caddr row))
)

(defun nl ()
 (write-char #linefeed)
 (finish-output nil))

(defun print-board (board)
  (if (>= (length board) 3)
    (progn
     (print-row board)
     (print-board (cdddr board)))
    (nl)
  )
)

;; must match all 3 positions (0 index)
;;
(defun match3 (pos3 board player)
 (and (eq (nth (car pos3) board) player)
      (eq (nth (cadr pos3) board) player)
      (eq (nth (caddr pos3) board) player))
)

;; true if player wins on board
;;
(defun winner (player board)
 (or
  (match3 '(0 1 2) board player)
  (match3 '(3 4 5) board player)
  (match3 '(6 7 8) board player)
  (match3 '(0 4 8) board player)
  (match3 '(6 4 2) board player)
  (match3 '(0 3 6) board player)
  (match3 '(1 4 7) board player)
  (match3 '(2 5 8) board player)
 )
)

;;;;;;;;;; some tests ;;;;;;;;;;
#|
(print-row '(1 2 3 4))
(print-board '(
   - - x 
   o x -
   x o o
))

; test using nth for matching
(print (match3 '(0 1 2) '(x x x) 'x))
(print (match3 '(0 1 2) '(x x y) 'x))

; test winning position
(print (winner 'x '(
   - - x 
   o x -
   x o o
)))
|#

;; display a really simple menu:
;; show choices, take an input and verify
;;
(defun simple-menu (prompt choices)
 (mapcar 'print choices)
 (nl)
 (loop
   (format t "~a" prompt)
   (finish-output nil)
   (let
    ((v (read t)))
   (if (or (< v 1) (> v (length choices)))
    (print 'invalid)
    (return v)
   ))))

;; check that element of board at position move
;; is 'free position' marker
;;
(defun is-valid (move board)
 (eq (nth move board) '-))

;; swap player symbol
;;
(defun other-player (p)
 (if (eq p 'x) 'o 'x))

;; get index of move for player
;;  note: internal indexing is 0 based
;;  but user indexing is 1 based (easier to visualize)
;;
(defun get-user-move (board player)
 (loop
  (format t "~a move (1 to 9) ? " player)
  (finish-output nil)
  (let ((move (- (read t) 1)))
   (if (is-valid move board)
    (return move))
   (format t "invalid - please retry ~%")
  )
 )
)

;; just peek first free position available
;;
(defun get-easy-move (board)
 (position '- board))

;; Several optimized implementations of minimax are available, like
;; http://www-users.cs.umn.edu/~gini/aiprog/rich-knight/minimax.lisp
;;
;; Here I try to code a simpler minimax search,
;; loosely inspired by: http://en.wikipedia.org/wiki/Minimax
;; Actually, here the tree is 'implicit' in the move generation loop.
;;
(defun minmax (depth board player maxmin)
 "return best pair position . value"
 ;(format t "~v<~>{ ~a ~a ~a~%" depth board player maxmin)
 (let
  ((best (cons nil 0))  ; if no move available: a draw
   temp opponent
  )
  (loop for p from 0 to 8 do ; generate moves
   (when (is-valid p board)
     (setq temp (copy-list board))
     (setf (nth p temp) player)

     ;(print-board temp)    
     (if (not (car best)) ; first move
       (setq best (cons p maxmin)))

     (when (winner player temp)
      ;(format t "~v<~>w ~a ~a ~a ~%"  depth temp player (cons p maxmin))
      (return (cons p maxmin))
     )

     ;; recursive call: invert evaluation
     (setq opponent
        (minmax (+ 1 depth) temp (other-player player) (* -1 maxmin)))

     ;(format t "~v<~> ~a ~a ~%" depth opponent best)
     (if (= maxmin 1)
       (if (< (cdr opponent) (cdr best))
        (setq best opponent))
       (if (> (cdr opponent) (cdr best))
        (setq best opponent))
     )

     ;(when (or (= 0 depth) (= 2 depth)) (format t "~v<~> * ~a ~a ~%" depth opponent best))
   )
  )
  ;(format t "~v<~>} ~a ~a ~a ~a~%" depth board player maxmin best)
  best
 )
)

;; while debugging minimax,
;; here is a very simple heuristic, playing fairly well
;;
(defun win-first-move (board player)
  (loop for p from 0 to 8 do ; generate moves
   (when (is-valid p board)
     (let ((temp (copy-list board)))
      (setf (nth p temp) player)
      (when (winner player temp)
       (return p))))))

(defun silly (board player)
 "a silly heuristic: either a winning move (player or adversary)
  or the first available"
 (let
  ((move (win-first-move board player)))
  (progn
   (if (not move)
    (setq move (win-first-move board (other-player player))))
   (if (not move)
    (setq move (get-easy-move board)))
  )
  (cons move nil)
 ))

;; keep generating a (pseudo)random index and
;; accept when it's an empty position
;;
(defun get-rand-move (board)
  (loop
   (let ((move (random 9)))
   (if (is-valid move board)
    (return move)
   ))))

;; peek a move with most simple heuristic
;;
(defun get-silly-move (board player)
 (car (silly board player)))

;; invoke minimax search
;;
(defun get-best-move (board player)
 (car (minmax 0 board player 1)))

;; dispatch move selection on player' strategy
;;
(defun get-move (board behaviour player)
 (cond
  ((eq behaviour 1) (get-user-move board player))
  ((eq behaviour 2) (get-easy-move board))
  ((eq behaviour 3) (get-rand-move board))
  ((eq behaviour 4) (get-silly-move board player))
  ((eq behaviour 5) (get-best-move board player)) ))

#|
(if nil ; debugging minmax on patterns
 (let*
  ((b '(- - o 
        x o x 
        - x -))
   (b '(x x - 
        - - - 
        - o -))
    (p 'o)
    (m (get-best-move b p))
  )
    (print m) (nl)
    (setf (nth m b) p)
    (print-board b)
))
|#

;; play a game
;; loop until either a player wins or no more moves are available
;;
(defun TIC-TAC-TOE (mode_x mode_o)
 (let
  ( (board (list '- '- '- '- '- '- '- '- '-))
    (player 'x) ; always start with X
    move
  )
  (loop
    (nl)
    (print-board board)

    ;; select a move (must be valid)
    (setq move
      (get-move board
        (if (eq player 'x) mode_x mode_o) player))

    ;(setq board (update-board move board))
    (setf (nth move board) player)

    (when (winner player board)
      (print-board board)
      (return player))

    ;; check if no more moves
    (when (not (find '- board))
      (print-board board)
      (return 'draw))

    ;; switch players
    (setq player (other-player player))
  )))

;; game interface
;;
(let
    ((choices '(1=user 2=easy 3=random 4=silly 5=best))
     (firstp 3)
     (secondp 5)
    )
    (if t ; set nil to use default settings
     (progn
      (setq firstp (simple-menu  "play first  (x):" choices))
      (setq secondp (simple-menu "play second (o):" choices)) ))
    (if t ; set nil to skip game interface while debugging
     (let
      ((result (TIC-TAC-TOE firstp secondp)))
      (if (eq result 'draw)
       (format t "the game is draw")
       (format t "player ~a wins" result))
     )))

The experts providing help with Lisp assignment have experience of Lisp related tutoring for more than ten years. Lisp’s dynamic typing and the common lisp conditioning system are some of the features that support the free flowing and interactive style of programming. Our aim in providing help with Lisp assignment is to provide precise and easily affordable service because we understand that as a student the budget is important for you. We have an enviable record of being one of the most economical homework service provider on the World Wide Web.

The applications developed in LISP which are largely successful and built in LISP are identified as overview lisp and Emacs. Emacs is a cross platform editor, which helps to identify the features like extensibility, customizability, self-document ability, and real-time display. CLISP is GNU Common and is defined as multi-architectural compiler and it is used for setting up LISP in Windows. The Windows version imitate UNIX environment using MingW under Windows.

LISP expressions are called symbolic expressions or S-expressions that are composed of three valid objects like Atoms, Lists and Strings. Any S-expression is a valid program and it runs either on an interpreter or as compiled code. The source code is checked by the interpreter in a repeated loop, called as Read-Evaluate-Print Loop (REPL) which reads the program code, evaluates it, and print values that are returned by the program. Our experts in LISP programming assignment help also offer solutions related to explaining the prefix notation, operators that are written before their operands and also clarify that LISP uses prefix notation.

So if you looking for LISP assignment solution online, then this is right place for you. Our experts are highly skilled. They have years of experience in providing LISP programming homework help and are also capable enough to provide any complex assignment solutions delivered within deadline. They are also available via chat. You can expect a simple and well commented code in the LISP programming assignment help solution.

Our experts providing Lisp assignment help are always there to help you solve the tricky problems in Lisp programming. Our services in Lisp programming assignment help is accurate and can be availed anytime. Lisp programming has come a long way since making a humble beginning in 1956. Lisp programming experts teach you Lisp by embodying the basic theme of Lisp programming that is interactive and incremental learning. Students sends request like do my Lisp assignment and our experts who are not only highly intelligent and accomplished academically but also have the experience of tutoring in Lisp related areas for many -many years provide them with best help.  The Lisp homework solutions encompasses the big picture by incorporating all the finer details in the programming solutions.

The Lisp programming experts who offer help with Lisp assignment are highly experienced and provide accurate lisp homework services. Our experts facilitating the Lisp project help have gathered and congregated from the finest universities of the world and are capable of satisfying even the most intellectual of the students.  Our capable expert consultants have the expertise of cracking the toughest problems in Lisp programming in a very short duration of time. There is no need to worry, as we are here to provide Lisp programming homework help and to take care of each and every aspect of your programming problem and provide solution to that. We provide help with Lisp assignment which is a highly resourceful and gainful service being provided to the students who seek help from us. We educate the students in Lisp programming in such a way that the students are qualified to attain the highest grades in their end semester and internal evaluation examination.  We provide extremely reliable computer programming assignment help services under the aegis of Lisp programming assignment help.