Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as text by berat ( 17 years ago )
(define-type LC ;lambda calculus
  [ids(id symbol?)] ;LENGTH = 1
  [deffunc(id symbol?) (body LC?)] ;length = 3
  [func-app(lhs LC?) (rhs LC?)]) ; length = 2

(define (recognizer lc)
  (cond
    ((symbol? lc) #t)
    ((or (list? lc) (= (length lc) 3) (equal? (first lc) 'λ) (symbol? (second lc)) (recognizer (third lc)) #t))
    ((and (list? lc) (= (length lc) 2) (recognizer (first lc)) (recognizer (second lc)) #t))
    ((or (empty? (second lc)) (empty? (third lc)) #f))
    ((and (symbol? (first lc)) (empty? (second lc)) #t))
    (else (error "invalid!!!"))))

(define (parse sexp)
   [(symbol? sexp) (ids sexp)]) 

> (parse '('x))
. . /home/berat/Desktop/proje2.scm:16:20: use broke the contract (-> symbol? ids?) on ids; expected <symbol?>, given: (list (list 'quote 'x))

i try to write parse method for lambda calculus.I took this error.What is my mistake.Some knows plai and lambda calculus pls help me a little bit
> 

> (parse (read))
'x
. . /home/berat/Desktop/proje2.scm:16:20: use broke the contract (-> symbol? ids?) on ids; expected <symbol?>, given: (list 'quote 'x)
>

 

Revise this Paste

Your Name: Code Language: