In lisp
How can you print the dot product of two lists but return
another list
if they are not equal in length? not an error message but an actual
list of words e.g
return '(Not the same length)
I keep getting a message not a number, no matter what I try.
(defun dot-product (a b)
(cond ((null a) (if (null b) 0 (error "Not the same length")))
((null b) (error "Not the same length"))
(t (+ (* (first a) (first b))
(dot-product (rest a) (rest b))))))
(setq mystring "This is . a . mixed string__ of character$$") (setq nocharacters (vl-list->string (vl-remove-if '(lambda (x) (member x '(97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90)) ) (vl-string->list mystring) ) ) )
Hope this helps you. For anymore queries kindly add comment. Please give an up vote. Thank you.
Get Answers For Free
Most questions answered within 1 hours.