The Function Keyword | OCaml Programming | Chapter 3 Video 9

preview_player
Показать описание
The `function` keyword provides helpful syntactic sugar for pattern matching.

Рекомендации по теме
Комментарии
Автор

2:09 `function` key words means to append against the last argument recieved.

mandalarian
Автор

I was doing some practice and realized that

let rec fib x = function
|0 -> 0
|1-> 1
|_ -> fib(x-1)+ fib(x-2);;
is wrong while

let rec fib x =
match x with
|0 -> 0
|1-> 1
|_ -> fib(x-1) + fib(x-2);;

why is that and I gathered from this lesson that the function key word takes away new to explicitly match

IncognitoLevi
Автор

What extension are you using to display syntax errors?

simbax
join shbcf.ru