-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
alok
committed
Apr 19, 2020
1 parent
0fd68d9
commit c642cbe
Showing
8 changed files
with
222 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
;; loop | ||
|
||
(setq *print-case* :capitalize) | ||
|
||
;; (loop for x from 1 to 10 | ||
;; do | ||
;; (print X)) | ||
|
||
|
||
;; or | ||
|
||
|
||
;; (setq x 1) | ||
;; (loop | ||
;; (format t "~d ~%" x) | ||
;; (setq x | ||
;; (+ x 1)) | ||
;; (when | ||
;; (> x 5) | ||
;; (return X))) | ||
|
||
;; ----------------------------------------------------- | ||
;; ----------------------------------------------------- | ||
|
||
;; list | ||
;; (loop for x in '(Sandeep Shobit Sumit) | ||
;; do | ||
;; (format t "~s ~%" x)) | ||
|
||
|
||
;; ----------------------------------------------------- | ||
;; ----------------------------------------------------- | ||
|
||
|
||
;; dotimes | ||
(dotimes (x 12) | ||
(print x)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
(setq *print-case* :capitalize) | ||
|
||
(format t "First Item: ~s ~%" | ||
(car ' | ||
(superman batman aquaman flash joker))) | ||
(format t "Items except First Item: ~s ~%" | ||
(cdr ' | ||
(superman batman aquaman flash joker))) | ||
(format t "Second Item: ~s ~%" | ||
(cadr ' | ||
(superman batman aquaman flash joker))) | ||
(format t "Third Item: ~s ~%" | ||
(caddr ' | ||
(superman batman aquaman flash joker))) | ||
(format t "Fourth Item: ~s ~%" | ||
(cadddr ' | ||
(superman batman aquaman flash joker))) | ||
|
||
|
||
|
||
|
||
(format t "IS IT A LIST? : ~s ~%" | ||
(listp ' | ||
(superman batman aquaman flash joker))) | ||
|
||
|
||
|
||
(format t "IS 3 IN THE LIST? : ~s ~%" | ||
(if | ||
(member 3 ' | ||
(2 4 6 8 10)) 't "Not in the list")) | ||
|
||
|
||
|
||
(defparameter *num-list* ' | ||
(2 4 6 8 10)) | ||
(push 1 *num-list*) | ||
(print *num-list*) | ||
(format t "Second item in the list: ~a ~%" | ||
(nth 2 *num-list*)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
(setq *print-case* :capitalize) | ||
|
||
(format t "(expt 4 2) = ~d ~%" | ||
(expt 4 2)) | ||
(format t "(sqrt 81) = ~d ~%" | ||
(sqrt 81)) | ||
(format t "(exp 1) = ~d ~%" | ||
(exp 1)) | ||
(format t "(log 1000 10) = ~d ~%" | ||
(log 1000 10)) | ||
(format t "(eq 'dog 'dog) = ~d ~%" | ||
(eq 'dog 'dog)) | ||
(format t "(floor 5.5) = ~d ~%" | ||
(floor 5.5)) | ||
(format t "(ceiling 5.5) = ~d ~%" | ||
(ceiling 5.5)) | ||
(format t "(max 5 10) = ~d ~%" | ||
(max 5 10)) | ||
(format t "(min 5 10) = ~d ~%" | ||
(min 5 10)) | ||
(format t "(oddp 15) = ~d ~%" | ||
(oddp 15)) | ||
(format t "(evenp 15) = ~d ~%" | ||
(evenp 15)) | ||
(format t "(numberp 12) = ~d ~%" | ||
(numberp 2)) | ||
(format t "(null nil) = ~d ~%" | ||
(null nil)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
(setq *print-case* :capitalize) | ||
|
||
(defparameter *name* 'ICT) | ||
(format t "(eq *name* 'ICT) = ~d ~%" | ||
(eq *name* 'ICT)) | ||
(format t "(equal 'CAR 'ICT) = ~d ~%" | ||
(equal 'CAR 'ICT)) | ||
(format t "(equal 10 10) = ~d ~%" | ||
(equal 10 10)) | ||
(format t "(equal 5.5 5.3) = ~d ~%" | ||
(equal 5.5 5.3)) | ||
(format t "(equal \"String 1\" \"String 123\" ) = ~d ~%" | ||
(equal "String 1" "String 123")) | ||
(format t "(equal (list 1 2 3) (list 1 2 3)) = ~d ~%" | ||
(equal | ||
(list 1 2 3) | ||
(list 1 2 3))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
(setq *print-case* :capitalize) | ||
|
||
(defparameter *name* 'ICT) | ||
(format t "(equalp 1.0 1) = ~d ~%" | ||
(equalp 1.0 1)) | ||
(format t "(equal 1.0 1) = ~d ~%" | ||
(equal 1.0 1)) | ||
(format t "(equalp \"ICT\" \"ict\") = ~d ~%" | ||
(equalp "ICT" "ict")) | ||
(format t "(equal \"ICT\" \"ict\") = ~d ~%" | ||
(equal "ICT" "ict")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
(setq *print-case* :capitalize) | ||
|
||
;; (defparameter *name* 'ICT) | ||
(print "Enter your age: ") | ||
(defvar *age* (read)) | ||
|
||
;; (if(= *age* 18) | ||
;; (format t "You can vote ~%") | ||
;; (format t "You cannot vote ~%") | ||
;; ) | ||
|
||
|
||
|
||
;; (if(not(= *age* 18)) | ||
;; (format t "You are 18 ~%") | ||
;; (format t "You are not 18 ~%") | ||
;; ) | ||
|
||
|
||
|
||
;; (if(and(>= *age* 18) (<= *age* 67)) | ||
;; (format t "Time for Work~%") | ||
;; (format t "Work if you want ~%")) | ||
|
||
|
||
|
||
|
||
(if(or(<= *age* 14) (>= *age* 67)) | ||
(format t "Yoy shouldn't Work~%") | ||
(format t "Time for work ~%")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
(setq *print-case* :capitalize) | ||
|
||
(defparameter *num1* 2) | ||
(defparameter *num2* 4) | ||
|
||
(format t "Num1 : ~d~%" *num1*) | ||
(format t "Num2 : ~d~%" *num2*) | ||
|
||
(print "Enter a number to multiply: ") | ||
(defparameter *num* | ||
(read)) | ||
|
||
(if | ||
(= *num* 2) | ||
(progn | ||
(setf *num1* | ||
(* *num1* *num*)) | ||
(setf *num2* | ||
(* *num2* *num*)) | ||
) | ||
(format t "Not equal to 2~%") | ||
) | ||
|
||
(format t "Num1 : ~d~%" *num1*) | ||
(format t "Num2 : ~d~%" *num2*) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
(setq *print-case* :capitalize) | ||
|
||
(print "Enter a number (0-9): ") | ||
(defparameter *num* | ||
(read)) | ||
|
||
(defun get-num | ||
(num) | ||
(case num | ||
(1 | ||
(print "One ")) | ||
(2 | ||
(print "Two ")) | ||
(3 | ||
(print "Three")) | ||
(4 | ||
(print "Four ")) | ||
(5 | ||
(print "Five ")) | ||
(6 | ||
(print "Six ")) | ||
(7 | ||
(print "Seven ")) | ||
(8 | ||
(print "Eight ")) | ||
(9 | ||
(print "Nine ")) | ||
(0 | ||
(print "Zero ")) | ||
(otherwise | ||
(print "Wrong Input")) | ||
)) | ||
(get-num *num*) |