2013-07-19 5 views
1

누군가 다음 코드가 '다음 미완료 파일 차단'오류를 표시하는 이유를 이해할 수 있도록 도와 주시겠습니까? 표현식 '이 필요하십니까? x의 값은 문자열 목록이 될 것으로 예상되며, F #이이를 어떻게 보는지입니다. 그러면 x가 함수의 뒷부분에서 사용할 문자열 목록이되지 않는 이유는 무엇입니까?F # |> (Pipeforward) '다음에 오는 블록이 완료되지 않았습니다.'오류

let fxProper (str : string) (values : obj[,]) = 
    let x = 
     values 
     |> Seq.cast<obj> 
     |> Seq.filter (fun x -> not (x :? ExcelEmpty)) 
     |> Seq.map string 
     |> Seq.toList 
+3

함수는'let' 바인딩으로 끝날 수 없습니다. 함수에서 값을 반환해야합니다. – MisterMetaphor

+0

(이것은 분명할지 모르지만 아직 응답자와 의견을 나눌 수는 없으므로 ...) x는 fxProper에 국한됩니다. 따라서 '함수의 뒷부분'에 의해'fxProper'보다 더 포괄적 인 것을 의미한다면, 그것의 범위에서 벗어나야 할 것입니다 –

답변

3

당신은 그냥 작동해야

let fxProper (str : string) (values : obj[,]) = 
    let x = 
     values 
     |> Seq.cast<obj> 
     |> Seq.filter (fun x -> not (x :? ExcelEmpty)) 
     |> Seq.map string 
     |> Seq.toList 
    x 

을 설정 x 값으로 뭔가를 할 필요가있다.

let fxProper (str : string) (values : obj[,]) = 
      values 
      |> Seq.cast<obj> 
      |> Seq.filter (fun x -> not (x :? ExcelEmpty)) 
      |> Seq.map string 
      |> Seq.toList 

는 잘 작동한다.

1

제대로하고 있습니다. x에 대한 바인딩 바인딩이 제대로 작동하고 있습니다. 이 오류는 귀하의 함수 fxProper이 현재 아무것도 반환하지 않는다고 알려줍니다. x를 반환하려는 경우 fxProper 끝에 추가해야합니다. 그렇지 않으면 함수 작성을 마칠 때까지 더미 반환 값을 추가하십시오.

let fxProper (str : string) (values : obj[,]) = 
    let x = 
     values 
     |> Seq.cast<obj> 
     |> Seq.filter (fun x -> not (x :? ExcelEmpty)) 
     |> Seq.map string 
     |> Seq.toList 
    x //this returns the value of x from fxProper, this could also just the default value of whatever you actually want to return here