<br>(define (valid-symbol? x)<br> (and (symbol? x) (not (equal? x &#39;¥ë))))<br><br>;;;<br><br>(define-type LS<br> (id (s symbol?))<br> (func-def (id symbol?) (body LS?))<br> (func-app (applier LS?) (applyed LS?)))<br><br>
;;recognizer: s-expression -&gt; boolean<br>;;x -&gt; #t<br>;;(x y) -&gt; #t<br>;;(x) -&gt; #f<br><br>(define (hof-filter s body)<br>  (filter (lambda(x) (equal? x s)) body))<br><br>(define (recognizer sexp)<br> (cond<br>
   ((valid-symbol? sexp) true)<br>   ((and (list? sexp) (= (length sexp) 3) (equal? (first sexp) &#39;¥ë)) (and (valid-symbol? (second sexp)) (recognizer (third sexp))))<br>   ((and (list? sexp) (= (length sexp) 2)) (and (recognizer (first sexp)) (recognizer (second sexp))))<br>
   (else false)))<br><br>;(test (recognizer &#39;ali) true)<br>;(test (recognizer &#39;(¥ë ali veli)) true)<br>;(test (recognizer &#39;(¥ë ali (¥ë veli nuri))) true)<br>;(test (recognizer &#39;(¥ë ali veli nuri)) false)<br>;(test (recognizer &#39;(ali nuri)) true)<br>
;(test (recognizer &#39;(ali &#39;(¥ë ali nuri))) true)<br>;(test (recognizer &#39;(ali)) false)<br>;(test (recognizer &#39;(k l z)) false)<br>;(test (recognizer &#39;(¥ë x)) false)<br>;(test (recognizer &#39;(¥ë ¥ë x)) false)<br>
;(test (recognizer &#39;(¥ë x ¥ë)) false)<br><br>;;parser<br>;;parser: s-exp--&gt; lambda-sentence<br><br>(define (parser sexp)<br> (cond<br>   ((valid-symbol? sexp) (id sexp))<br>   ((and (list? sexp) (= (length sexp) 3) (equal? (first sexp) &#39;¥ë)) (func-def  (second sexp) (parser (third sexp))))<br>
   ((and (list? sexp) (= (length sexp) 2)) (func-app  (parser  (first sexp)) (parser  (second sexp))))<br>   (else (error &quot;z&quot;))))<br>;(parser &#39;(¥ë x (¥ë y (y x))))<br>;(test (parser &#39;x) (id &#39;x))<br>;(test (parser &#39;(x y)) (func-app (id &#39;x) (id &#39;y)))<br>
(parser &#39;(¥ë x (¥ë y ((y z) v))))<br>;(func-def  &#39;x (id &#39;y)))<br>;(test (parser &#39;((¥ë x y) (¥ë z x))))<br>;(test (parse &#39;(¥ë x(¥ë y ((y x) z)))))<br>;(parser &#39;x)<br>;(parser &#39;(x y))<br>;(parser &#39;(¥ë x y))<br>
<br>;<br><br>(define (remove-from-body s body)<br>  (cond<br>    ((null? body) null)<br>    ((not (equal? s (car body))) (cons (car body) (remove-from-body s (cdr body))))<br>    (else<br>     (remove-from-body s (cdr body)))))<br>
;contract : s(element) body(list) -&gt; body <br>(define (addition s body)<br>  (cond<br>    ((null? body) null)<br>    ((eqv? s (car body))  body)<br>    ;(((not (eqv? s (car body))) (cons s (car body)))))<br>    (else<br>
      (cons s (car body)))))<br>  <br>   <br><br>(define (append-my-own-ver body1 body2)<br>  (cond<br>    ((null?  body1) body2)<br>    ((null?  body2) body1)<br>    (else<br>     (cons (car body1) (append-my-own-ver (cdr body1)  body2)))))<br>
<br>;;LS--&gt; list-of-free variables<br>(define (find-frees ls)<br>(type-case LS ls<br>            (id (x) (list x))<br>            (func-def (name body) (remove-from-body name (find-frees body)))<br>            (func-app (body1 body2) (append-my-own-ver (find-frees body1) (find-frees body2)))))<br>
<br>(define (find-bounds ls)<br>(type-case LS ls<br>            (id (x) (list x))<br>            (func-def (name body) (addition name (find-bounds body)))<br><p>            (func-app (body1 body2) (append-my-own-ver (find-bounds body1) (find-bounds body2)))))<br>
</p><p><br></p><p>i try to implement lambda calculu©¥s in plai scheme.I define find-frees which help from a function that is remove-from body.That works perfectly.</p><p>And i wrote find-bounds which takes help from a function whose name is addition.But find-bounds is little problematic and i cannot find the mistake.How can i fix that ?</p>
<p>thank very regards.</p>