1. Home
  2. /
  3. Ml
  4. /
  5. Fibonacci Sequence

Fibonacci Sequence - Ml Typing CST Test

Loading…

Fibonacci Sequence — Ml Code

Generates the first 10 Fibonacci numbers recursively.

fun fib 0 = 0
  | fib 1 = 1
  | fib n = fib(n-1) + fib(n-2)

fun printFib n = 
	if n < 10 then (
		print (Int.toString(fib n) ^ "\n");
		printFib (n+1)
	) else ()

printFib 0;

Ml Language Guide

ML (Meta Language) is a functional programming language known for its strong static type system, type inference, and pattern matching capabilities. It emphasizes immutability, recursion, and expressive type-safe programming, making it ideal for symbolic computation, theorem proving, and compiler development.

Primary Use Cases

  • ▸Compiler and interpreter development
  • ▸Theorem proving and formal verification
  • ▸Symbolic computation
  • ▸Algorithm prototyping
  • ▸Academic research and teaching functional programming

Notable Features

  • ▸Strong static typing with type inference
  • ▸Pattern matching for control flow
  • ▸Immutable data structures by default
  • ▸First-class functions and higher-order functions
  • ▸Module and functor system for abstraction

Origin & Creator

ML was developed in the early 1970s by Robin Milner and colleagues at the University of Edinburgh as a metalanguage for the LCF theorem prover.

Industrial Note

ML influenced many functional languages like OCaml, F#, and Haskell. It is still used in formal methods, compiler construction, and language research.

More Ml Typing Exercises

ML Counter and Theme ToggleML Factorial CalculatorML Prime CheckerML Sum of ListML Reverse StringML Multiplication TableML Celsius to FahrenheitML Simple Alarm SimulationML Random Walk Simulation

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher