SlideShare a Scribd company logo
How to convert into cellcious to the Fahrenheit in lisp
programming?
Formulae=5/9(f-32)
Solution:
(defun convert(c)(* (- c 32)(/ 5 9)))
Solution:
(defun convert(f)(+ (* (/ 9 5)f)))
Lisp in Small Parts
Search
Introduction
 Debugging in LispWorks
Getting Started
 Lists
 Expressions
 Defining Procedures
 Variables
 Manipulating Lists
 Strings
 Printing
 Testing a Result
 Creating Dialogue Boxes
Writing Programs
 Processing Items in a List
 Repeating Operations
 More about Recursion
 Generalising Procedures
Projects
 Animals
 Anagrams
 Recipes
 Map
 Turtle Graphics
 Logic Mazes
 Number Countdown
Answers to Exercises
Index of Procedures

Suggested sites
Answers to Exercises
Not all the exercises have answers yet.
Lists
1.
(list 1 (list 2 (list 3 4)))
Expressions
Defining Procedures
1. Square a number
(defun square (number)
(* number number))
2. Find the nth triangular number
(defun triangular (n)
(/ (* n (+ n 1)) 2))
3. Find the result of throwing two dice
(defun two-dice ()
(+ (+ 1 (random 6)) (+ 1 (random 6))))
Variables
1. Convert between km and miles
(defparameter kilometresinmiles 0.621371192)
(defun convert-km (km)
(* km kilometresinmiles))
(defun convert-miles (miles)
(/ miles kilometresinmiles))
2. Find the average of three numbers
(defun average3 (number1 number2 number3)
(/ (+ number1 number2 number3) 3))
3. Cube the sum of two numbers
(defun cubesum (a b)
(let* ((total (+ a b))
(answer (* total total total)))
answer))
4. Substitute values into a quadratic equation
(defun pseudo-primes (x)
(+ (- (* x x) x) 41))
Manipulating Lists
1. Swap the first two items in a list
(defun swap (lst)
(cons (second lst) (cons (first lst) (rest (rest lst)))))
2. Duplicate the first item in a list
(defun dup (lst)
(cons (first lst) lst))
3. Return a random item from a list
(defun random-elt (lst)
(nth (random (length lst)) lst))
4. Return the last item in a list
(defun last-elt (lst)
(nth (- (length lst) 1) lst))
Strings

More Related Content

PPT
A2 Computing Reverse Polish Notation Part 2
PPT
Functions by mstfdemirdag
PDF
Linked list Output tracing
PDF
Merge sort
PDF
PPT
Recurrence theorem
PPTX
A Short Study of Galois Field
PPT
lecture 4
A2 Computing Reverse Polish Notation Part 2
Functions by mstfdemirdag
Linked list Output tracing
Merge sort
Recurrence theorem
A Short Study of Galois Field
lecture 4

What's hot (20)

PDF
Functions
PPT
L3 functions operations
ODP
Log summary & equations
PPTX
Merge sort code in C explained
PPTX
5 4 function notation
PPTX
Asymptotic Notation
KEY
Function Basics Math Wiki
PDF
Day 1 examples new
PPTX
Chapter 22 Finite Field
PDF
2Bytesprog2 course_2014_c6_single linked list
PDF
Ch04
PDF
Digital Signals and System (October – 2016) [Revised Syllabus | Question Paper]
PDF
4R2012 preTest10A
PPTX
Breadth First Search & Depth First Search
PDF
one main advantage of bubble sort as compared to others
PDF
10 modtab
PPT
computer notes - Data Structures - 26
Functions
L3 functions operations
Log summary & equations
Merge sort code in C explained
5 4 function notation
Asymptotic Notation
Function Basics Math Wiki
Day 1 examples new
Chapter 22 Finite Field
2Bytesprog2 course_2014_c6_single linked list
Ch04
Digital Signals and System (October – 2016) [Revised Syllabus | Question Paper]
4R2012 preTest10A
Breadth First Search & Depth First Search
one main advantage of bubble sort as compared to others
10 modtab
computer notes - Data Structures - 26
Ad

More from ilias ahmed (20)

DOCX
We need parallel or series connections of n mos and pmos with a nmos source t...
PPTX
Android development-tutorial
PPSX
Signle assignmentforbciit
PPTX
Compiler design lab
PPTX
Labreportofai
DOCX
Ailabreport
PPT
artificial intelligence
PPSX
Compiler designs presentation final
PPSX
Compiler designs presentation by group 2 final final
PPT
Assmemble langauge for slideshare.net
DOCX
Phpfundamnetalfromtutplus
DOCX
Assignment complier design (GROUP1)
DOCX
Lispprograaming excercise
PPTX
Assembly lab up to 6 up (1)
PDF
Event design
PPT
PPT
Data communications
PPSX
Microprocessor projec ts
PPSX
Oop features java presentationshow
RTF
Sql functions
We need parallel or series connections of n mos and pmos with a nmos source t...
Android development-tutorial
Signle assignmentforbciit
Compiler design lab
Labreportofai
Ailabreport
artificial intelligence
Compiler designs presentation final
Compiler designs presentation by group 2 final final
Assmemble langauge for slideshare.net
Phpfundamnetalfromtutplus
Assignment complier design (GROUP1)
Lispprograaming excercise
Assembly lab up to 6 up (1)
Event design
Data communications
Microprocessor projec ts
Oop features java presentationshow
Sql functions
Ad

Recently uploaded (20)

PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PPTX
Cell Structure & Organelles in detailed.
PDF
Open folder Downloads.pdf yes yes ges yes
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
Business Ethics Teaching Materials for college
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
Basic Mud Logging Guide for educational purpose
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
GDM (1) (1).pptx small presentation for students
PDF
01-Introduction-to-Information-Management.pdf
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
Cell Structure & Organelles in detailed.
Open folder Downloads.pdf yes yes ges yes
Microbial diseases, their pathogenesis and prophylaxis
102 student loan defaulters named and shamed – Is someone you know on the list?
O5-L3 Freight Transport Ops (International) V1.pdf
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPH.pptx obstetrics and gynecology in nursing
Business Ethics Teaching Materials for college
human mycosis Human fungal infections are called human mycosis..pptx
Anesthesia in Laparoscopic Surgery in India
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Basic Mud Logging Guide for educational purpose
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
GDM (1) (1).pptx small presentation for students
01-Introduction-to-Information-Management.pdf
STATICS OF THE RIGID BODIES Hibbelers.pdf

Lisp programming

  • 1. How to convert into cellcious to the Fahrenheit in lisp programming? Formulae=5/9(f-32) Solution: (defun convert(c)(* (- c 32)(/ 5 9))) Solution: (defun convert(f)(+ (* (/ 9 5)f))) Lisp in Small Parts Search Introduction  Debugging in LispWorks Getting Started  Lists  Expressions  Defining Procedures  Variables  Manipulating Lists  Strings  Printing
  • 2.  Testing a Result  Creating Dialogue Boxes Writing Programs  Processing Items in a List  Repeating Operations  More about Recursion  Generalising Procedures Projects  Animals  Anagrams  Recipes  Map  Turtle Graphics  Logic Mazes  Number Countdown Answers to Exercises Index of Procedures  Suggested sites Answers to Exercises Not all the exercises have answers yet. Lists 1. (list 1 (list 2 (list 3 4))) Expressions Defining Procedures 1. Square a number (defun square (number) (* number number)) 2. Find the nth triangular number (defun triangular (n)
  • 3. (/ (* n (+ n 1)) 2)) 3. Find the result of throwing two dice (defun two-dice () (+ (+ 1 (random 6)) (+ 1 (random 6)))) Variables 1. Convert between km and miles (defparameter kilometresinmiles 0.621371192) (defun convert-km (km) (* km kilometresinmiles)) (defun convert-miles (miles) (/ miles kilometresinmiles)) 2. Find the average of three numbers (defun average3 (number1 number2 number3) (/ (+ number1 number2 number3) 3)) 3. Cube the sum of two numbers (defun cubesum (a b) (let* ((total (+ a b)) (answer (* total total total))) answer)) 4. Substitute values into a quadratic equation (defun pseudo-primes (x) (+ (- (* x x) x) 41)) Manipulating Lists 1. Swap the first two items in a list (defun swap (lst) (cons (second lst) (cons (first lst) (rest (rest lst))))) 2. Duplicate the first item in a list (defun dup (lst) (cons (first lst) lst)) 3. Return a random item from a list (defun random-elt (lst) (nth (random (length lst)) lst))
  • 4. 4. Return the last item in a list (defun last-elt (lst) (nth (- (length lst) 1) lst)) Strings