- [n207go@n207go ~]$ clisp
- i i i i i i i ooooo o ooooooo ooooo ooooo
- I I I I I I I 8 8 8 8 8 o 8 8
- I \ `+' / I 8 8 8 8 8 8
- \ `-+-' / 8 8 8 ooooo 8oooo
- `-__|__-' 8 8 8 8 8
- | 8 o 8 8 o 8 8
- ------+------ ooooo 8oooooo ooo8ooo ooooo 8
- Welcome to GNU CLISP 2.49 (2010-07-07) <http://clisp.cons.org/>
- Copyright (c) Bruno Haible, Michael Stoll 1992, 1993
- Copyright (c) Bruno Haible, Marcus Daniels 1994-1997
- Copyright (c) Bruno Haible, Pierpaolo Bernardi, Sam Steingold 1998
- Copyright (c) Bruno Haible, Sam Steingold 1999-2000
- Copyright (c) Sam Steingold, Bruno Haible 2001-2010
- Type :h and hit Enter for context help.
- [1]> (defun start () ;defining domain and range
- (defparameter *fdomain-min* 1)
- (defparameter *fdomain-max* 5)
- (defparameter *frange-min* 2)
- (defparameter *frange-max* 6)
- (defparameter *gdomain-min* 2)
- (defparameter *gdomain-max* 8)
- (defparameter *grange-min* 0)
- (defparameter *grange-max* 3)
- ;defining variables (will change)
- (defparameter *fx* 0)
- (defparameter *gx* 0)
- (defparameter *fog* 0)
- (defparameter *gof* 0)
- ;defining functions
- ;(defun fx ()
- ; (progn (if (< *fx* 1) "none"
- ; (if (> *fx* 5) "none"
- ; (- 7 *fx*)))
- ; (setf *fx* (+ *fx* 1))))
- ;(defun gx ()
- ; (progn (if (< *gx* 2) "none"
- ; (if (> *gx* 8) "none"
- ; (- (* 1/2 *gx*) 1)))
- ; (setf *gx* (+ *gx* 1))))
- (defun fx-nosetf (x)
- (if (< x 1) "none"
- (if (> x 5) "none"
- (- 7 x))))
- (defun gx-nosetf (x)
- (if (< x 2) "none"
- (if (> x 8) "none"
- (- (* 1/2 x) 1))))
- (defun fog (x)
- (if (or (equal (gx-nosetf x) "none") (equal (fx-nosetf (gx-nosetf x)) "none"))
- "none"
- (fx-nosetf (gx-nosetf x))))
- (defun gof (x)
- (if (or (equal (fx-nosetf x) "none") (equal (fx-nosetf (fx-nosetf x)) "none"))
- "none"
- (gx-nosetf (fx-nosetf x))))
- ;(defun fog ()
- ; (if (or (equal (fx-nosetf *fog*) "none") (equal (gx-nosetf *fog*) "none")) "n
- one"
- ; (progn
- ; (fx-nosetf (gx-nosetf *fog*))
- ; (setf *fog* (+ *fog* 1)))))
- ;(defun gof ()
- ; (if (or (equal (fx-nosetf *gof*) "none") (equal (gx-nosetf *gof*) "none")) "n
- one"
- ; (progn
- ; (gx-nosetf (fx-nosetf *gof*))
- ; (setf *gof* (+ *gof* 1)))))
- ;defining table function
- (defun table (x) (format t "~5t~a ~15t~a, ~25t~a ~35t~a, ~45t~a ~55t~a, ~65t~a ~
- 75t~a, ~85t~a, ~95t~a~%"
- "x" x "fx" (fx-nosetf x) "gx" (gx-nosetf x) "fog"
- (fog x) "gof" (gof x)))
- (table 0)
- (table 1)
- (table 2)
- (table 3)
- (table 4)
- (table 5)
- (table 6)
- (table 7)
- (table 8)
- (table 9)
- (table 10)
- ;now must answer questions
- (princ "#3 is included in table")
- (princ "#4 see table, notice when x= 6, 7, 8, that there is value for gx but not
- for gof")
- (princ "#5 plotted, lie on straight line, you can tell from table because the de
- crease is the same")
- (princ "#6 the domain of f o g is [4,8] and the range [1,3]")
- (princ "#7, the equations are f(x)=-x+7 and g(x)=1/2x-1")
- (princ "yes, table values match up, while boolean values limit domain/range appr
- opriately")
- (princ "yes, the graphs are consistent")
- (princ "f(g(x)) would be -(1/2x-1)+7, so -1/2x+1+7, so -1/2+8")
- (princ "I learned a ton of stuff about lisp :D, but i also learned more about ho
- w to use my calculator, and about the domain and ranges of composition functions
- ")
- )
- START
- [2]> (start)
- x 0, fx none, gx none, fog none,
- gof, none
- x 1, fx 6, gx none, fog none,
- gof, none
- x 2, fx 5, gx 0, fog none,
- gof, 3/2
- x 3, fx 4, gx 1/2, fog none,
- gof, 1
- x 4, fx 3, gx 1, fog 6,
- gof, 1/2
- x 5, fx 2, gx 3/2, fog 11/2,
- gof, 0
- x 6, fx none, gx 2, fog 5,
- gof, none
- x 7, fx none, gx 5/2, fog 9/2,
- gof, none
- x 8, fx none, gx 3, fog 4,
- gof, none
- x 9, fx none, gx none, fog none,
- gof, none
- x 10, fx none, gx none, fog none,
- gof, none
- #3 is included in table#4 see table, notice when x= 6, 7, 8, that there is value
- for gx but not for gof#5 plotted, lie on straight line, you can tell from table
- because the decrease is the same#6 the domain of f o g is [4,8] and the range [
- 1,3]#7, the equations are f(x)=-x+7 and g(x)=1/2x-1yes, table values match up, w
- hile boolean values limit domain/range appropriatelyyes, the graphs are consiste
- ntf(g(x)) would be -(1/2x-1)+7, so -1/2x+1+7, so -1/2+8I learned a ton of stuff
- about lisp :D, but i also learned more about how to use my calculator, and about
- the domain and ranges of composition functions
- "I learned a ton of stuff about lisp :D, but i also learned more about how to us
- e my calculator, and about the domain and ranges of composition functions"
- [3]>