게시판 인덱스

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

Project Problem3

 
글 쓰기   답변 달기     게시판 인덱스 -> 4190.210 Principles of Programming (Fall 2014)
이전 주제 보기 :: 다음 주제 보기  
글쓴이 메시지
AlenaKazakova



가입: 2014년 9월 24일
올린 글: 9

올리기올려짐: 2014년12월8일 10:29    주제: Project Problem3 인용과 함께 답변

According to the 3rd task I have to check expression before transformation: whether "repeat E1 E2" does not have E1 < 0. But expression E1 itself could have "Read" command, so how to be sure that the "Read" expression will have a same value at "checking before transformation" and at "transformation time" the same input?

Please let me know how should I implement "Read" expression, should I use "input_line stdin"?

Thank you.
위로
사용자 정보 보기 비밀 메시지 보내기
김윤승



가입: 2014년 9월 1일
올린 글: 452
위치: 302동 312-2호

올리기올려짐: 2014년12월8일 19:04    주제: 인용과 함께 답변

I think I don't understand your question clearly.

In this problem, you don't check whether the two programs (before and after the transformation) do the same task, though they should do.

What you should check are:
1. whether the input "exp" contains a meaningless expression.
2. whether the output "cmd" is well-constructed. (Check the two requirements written in the document)

Also, you don't 'implement' "Read". Your task is just to transform an "exp" into a "cmd".

If this doesn't give you the answer, let me know.
위로
사용자 정보 보기 비밀 메시지 보내기
AlenaKazakova



가입: 2014년 9월 24일
올린 글: 9

올리기올려짐: 2014년12월8일 19:34    주제: Clarification of the Question 인용과 함께 답변

코드:
repeat  (read) 5

This is example of normal expression according to type definition.
How to check whether (read) is not negative?
위로
사용자 정보 보기 비밀 메시지 보내기
김윤승



가입: 2014년 9월 1일
올린 글: 452
위치: 302동 312-2호

올리기올려짐: 2014년12월8일 22:22    주제: 인용과 함께 답변

You don't know the value of "read".

It is always between -100 and 100.

Your check_exp should reject that code, because the value can be negative.

However, something like [repeat (read + 100) 5] is always valid.

The important point is, making perfect [check_exp] is (almost) impossible.

So if you think there is a possibility that the first argument of any [repeat] becomes negative, [check_exp] should reject the expression.
위로
사용자 정보 보기 비밀 메시지 보내기
AlenaKazakova



가입: 2014년 9월 24일
올린 글: 9

올리기올려짐: 2014년12월8일 23:09    주제: 인용과 함께 답변

You made a code to evaluate expression using input int list, in our task source we have "val check_exp: exp -> bool" interface.
So it is not clear how to use your "interpreter.ml". Please explain why did you upload it?
Because "val check_exp: exp -> bool" does not have any way to provide the input stream to Read function, I have implemented it as (input_line stdin), please explain what is correct way to implement Read?
위로
사용자 정보 보기 비밀 메시지 보내기
김윤승



가입: 2014년 9월 1일
올린 글: 452
위치: 302동 312-2호

올리기올려짐: 2014년12월9일 0:09    주제: 인용과 함께 답변

You are misunderstanding the problem.

[check_exp] does not "run" the input expression. It just expects the "possible behavior" of the expression.

Just regard [read] as [random()] which returns a value between -100 and 100.

[check_exp (repeat (read + 1) 1)] should return false, because there is a possible execution that (read+1) becomes negative. (You don't get any keyboard input from outside.)

[check_exp (repeat (read + 101) 1)] may return true, because all executions are valid regardless of the value of [read].

Again, it's impossible to make [check_exp] perfect, which means, sometimes your [check_exp] returns false even if the input expression is always valid, but this is OK.
However, your [check_exp] should not return true for expressions which have at least one "invalid" execution.
위로
사용자 정보 보기 비밀 메시지 보내기
이전 글 표시:   
글 쓰기   답변 달기     게시판 인덱스 -> 4190.210 Principles of Programming (Fall 2014) 시간대: GMT + 9 시간(한국)
페이지 11

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


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