Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Execute LISP Online

;(print "mapping tests")

;; Helper that given a 2 length string, it will determine
;; if the (car L) is smaller than the value 


;(defun map-help (L val)
;    (cond
;    ((< (car L) val) (car (cdr L)))
;    )
;)

;(defun mapping (L val)
;    (cond 
;    ((null l) nil)
;    ((null (map-help (car L) val)) (mapping (cdr L) val))
;    (T (cons (map-help (car L) val) (mapping (cdr L) val)))
;    )
;)

;(print (mapping `((3 hello) (1 there)) 5))
;(print (mapping `((3 hello) (5 notme) (1 there)) 5))
;(print (mapping `((35 kim) (67 clinton) (45 emma)) 40))
;(print (mapping `((24 a) (15 b) (56 c) (19 d)) 26))
;(print (mapping `((90 a) (80 b) (70 c)) 40))

(defun pattern-helper(L1 L2)
    (cond 
    ((null (cdr L1)) (eq (car L1) (car L2))))
    ((eq (car L1) (car L2)) (pattern-helper (cdr L1) (cdr L2)))
    )
)







Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.