| 이전 주제 보기 :: 다음 주제 보기 |
| 글쓴이 |
메시지 |
AlenaKazakova
가입: 2014년 9월 24일 올린 글: 9
|
올려짐: 2014년10월15일 18:05 주제: HW3-1 |
|
|
Could you please explain how exactly do you want type checking to be done?
Is it like this:
(provide (contract-out [add (-> number? number? number?)]))
?
I couldn't find it on the lecture slides. |
|
| 위로 |
|
 |
김윤승
가입: 2014년 9월 1일 올린 글: 452 위치: 302동 312-2호
|
올려짐: 2014년10월15일 18:27 주제: |
|
|
Do it like page 108 of the "Part 1: For lecture" slide, which is:
{= : int * int -> bool}
{* : int * int -> int}
{- : int * int -> int}
{(define (fac {n : int})
{(if {(= {n : int} {0 : int}) : bool}
{1 : int}
{(* {n : int}
{(fac {(- {n:int} {1:int}) : int}) : int}
) : int}
) : int}
) : int -> int} |
|
| 위로 |
|
 |
AlenaKazakova
가입: 2014년 9월 24일 올린 글: 9
|
올려짐: 2014년10월15일 19:51 주제: |
|
|
I saw this, but #lang racket does not understand the notation. Why is that?
Thank you. |
|
| 위로 |
|
 |
김윤승
가입: 2014년 9월 1일 올린 글: 452 위치: 302동 312-2호
|
올려짐: 2014년10월15일 23:39 주제: |
|
|
| That's the right way. We are not going to run the program. We will just read it. |
|
| 위로 |
|
 |
|