Regarding OCaml, it was originally called Objective Caml. It was the main implementation of the Caml programming language. The development tools include an interactive top-level interpreter, a bytecode compiler, and an optimal native code compiler. Ocaml has a huge standard library, making it easy to develop various applications like Python or Perl.
For programmers, OCaml is promoted by the programming language community and provides targeted support, automatic memory management and device portability. The OCaml application is currently available for download from Apple’s App Store. Through the application features of OCaml language, you can build a website that teaches algebra.
ocaml simple example (Linux)
ocaml notes
Single line comment:
Multi-line comments:
Nested (… *) blocks can be used in OCaml, so we can easily comment out a block of programs.
Call functions
In ocaml, it is wrong to enclose parameters in parentheses and separate parameters with commas.
Under normal circumstances, the parentheses only enclose the entire function call, do not enclose the parameters of the function call.
Function definition
Some features of ocaml function:
OCaml is a strongly statically typed language. (That is to say, there is no dynamic type as in perl).
OCaml uses type inference to find the type, so you don't need to specify the type. If you use the toplevel of the above OCaml, then OCaml will show the type of function it thinks.
OCaml does not do any implicit conversion. If you need floating point numbers, you must write 2.0, because 2 is an integer. OCaml never performs any automatic type conversion.
Due to the side effects of type inference, OCaml does not allow any form of overloading (including operator overloading). It uses different operators to mean "add two integers" (use +) and "add two floating-point numbers" (use +.). Note that the latter has a dot. The same goes for other arithmetic operators (-., *., /.).
OCaml returns the last expression value of the function, so we don't need to write return as in C.
basic type
int char float bool string unit (return type of void)
Female Header Connector,0.80Mm Female Header Connector,2.54Mm Female Header Connector,3.96Mm Female Header Connector
Shenzhen CGE Electronics Co.,Ltd , https://www.cgeconnector.com