2014-13485
가입: 2017년 9월 15일 올린 글: 3
|
올려짐: 2017년9월15일 15:46 주제: 과제 2-6 질문 |
|
|
코드: |
module IntListQ : Queue =
struct
type element = int list
type queue = ...
...
...
end
let myQ = IntListQ.emptyQ
let yourQ = IntListQ.enQ(myQ, [1])
|
이를 실행시켜보면
Error : This expression has type 'a list
but an expression was expected of type IntListQ.element
라고 뜨는데 [1] 이 int list 이고 int list 가 IntListQ.element 와 같은 타입이라는 것을 인지하지 못해서 생기는 문제인 게 맞나요? 맞다면 어떻게 해결해야 하나요?
위 테스트 코드를
코드: |
let myQ = IntListQ.emptyQ
let p : IntListQ.element = [1;2;3]
|
로 바꿔도 정확히 똑같은 오류가 납니다.[/code] |
|