게시판 인덱스

 
 FAQFAQ   검색검색   멤버리스트멤버리스트   사용자 그룹사용자 그룹   사용자 등록하기사용자 등록하기 
 개인 정보개인 정보   비공개 메시지를 확인하려면 로그인하십시오비공개 메시지를 확인하려면 로그인하십시오   로그인로그인 

숙제 4-2 주어지는 함수

 
이 게시판은 잠겼으므로 글을 올리거나, 답변을 하거나 수정을 할 수 없습니다   이 주제는 잠겼으므로 답변을 하거나 수정을 할 수 없습니다     게시판 인덱스 -> 4190.210 Principles of Programming (Fall 2011)
이전 주제 보기 :: 다음 주제 보기  
글쓴이 메시지
이승중



가입: 2010년 6월 22일
올린 글: 561

올리기올려짐: 2011년10월16일 10:11    주제: 숙제 4-2 주어지는 함수 인용과 함께 답변

코드:
(define (mustItems giftList)
  (cons 'items giftList))

(define (mustBeTheSame id)
  (cons 'same id))

(define (mustHaveExceptFor cond giftList)
  (cons 'except (cons cond giftList)))

(define (mustHaveCommon cond1 cond2)
  (cons 'common (cons cond1 cond2)))

(define (mustAnd cond1 cond2)
  (cons 'and (cons cond1 cond2)))

(define (isItems cond)
  (define tag (car cond))
  (eq? tag 'items))

(define (isSame cond)
  (define tag (car cond))
  (eq? tag 'same))

(define (isExcept cond)
  (define tag (car cond))
  (eq? tag 'except))

(define (isCommon cond)
  (define tag (car cond))
  (eq? tag 'common))

(define (isAnd cond)
  (define tag (car cond))
  (eq? tag 'and))

(define (whichItems cond)
  (if (isItems cond) (cdr cond) (error "Not 'Items' Condition")))

(define (whoTheSame cond)
  (if (isSame cond) (cdr cond) (error "Not 'Same' Condition")))

(define (condExcept cond)
  (if (isExcept cond) (car (cdr cond)) (error "Not 'Except' Condition")))

(define (itemsExcept cond)
  (if (isExcept cond) (cdr (cdr cond)) (error "Not 'Except' Condition"))) 

(define (condCommon cond)
  (if (isCommon cond) (cdr cond) (error "Not 'Common' Condition")))

(define (condAnd cond)
  (if (isAnd cond) (cdr cond) (error "Not 'And' Condition")))
위로
사용자 정보 보기 비밀 메시지 보내기
이전 글 표시:   
이 게시판은 잠겼으므로 글을 올리거나, 답변을 하거나 수정을 할 수 없습니다   이 주제는 잠겼으므로 답변을 하거나 수정을 할 수 없습니다     게시판 인덱스 -> 4190.210 Principles of Programming (Fall 2011) 시간대: GMT + 9 시간(한국)
페이지 11

 
건너뛰기:  
새로운 주제를 올릴 수 없습니다
답글을 올릴 수 없습니다
주제를 수정할 수 없습니다
올린 글을 삭제할 수 없습니다
투표를 할 수 없습니다


Powered by phpBB 2.0.21-7 (Debian) © 2001, 2005 phpBB Group
Translated by kss & drssay