Front Page All Articles Recent Changes Random Article

Contents

Concatenative language

  • ACL
  • Ait
  • Aocla
  • Breeze
  • Callisto
  • Cat
  • Cognate
  • colorForth
  • Concata
  • CoSy
  • Deque
  • DSSP
  • dt
  • Elymas
  • Enchilada
  • ETAC
  • F
  • Factor
  • Fiveth
  • Forth
  • Fourth
  • Freelang
  • Gershwin
  • hex
  • iNet
  • Joy
  • Joy of Postfix App
  • kcats
  • Kitten
  • lang5
  • Listack
  • LSE64
  • Lviv
  • Meow5
  • min
  • Mirth
  • mjoy
  • Mlatu
  • Ode
  • OForth
  • Om
  • Onyx
  • Plorth
  • Popr
  • Porth
  • PostScript
  • Prowl
  • Quest32
  • Quackery
  • r3
  • Raven
  • Retro
  • RPL
  • SPL
  • Staapl
  • Stabel
  • Tal
  • Titan
  • Trith
  • Uiua
  • Worst
  • xs
  • XY
  • 5th
  • 8th

Concatenative topics

  • Compilers
  • Interpreters
  • Type systems
  • Object systems
  • Quotations
  • Variables
  • Garbage collection
  • Example programs

Concatenative meta

  • People
  • Communities

Other languages

  • APL
  • C++
  • Erlang
  • FP trivia
  • Haskell
  • Io
  • Java
  • JavaScript
  • Lisp
  • ML
  • Oberon
  • RPL
  • Self
  • Slate
  • Smalltalk

Meta

  • Search
  • Farkup wiki format
  • Etiquette
  • Sandbox

ML

ML is a family of general-purpose, strong-typed, non-pure functional languages. The most known derivatives of ML are Standard ML and OCaml.

Features:

  • Supporting both of functional and imperative coding styles
  • Object oriented programming (OCaml)
  • Garbage collection
  • Polymorphic types
  • Pattern matching
  • Highly expressive syntax

Standard ML implementations:

  • MLton
  • Moscow ML
  • Poly/ML
  • SML/NJ - Standard ML of New Jersey

OCaml:

  • OCaml home - Distributions and documentation

Example code (in OCaml):

(* An implementation of the factorial computing function
 * in different coding styles.
 * Note that the argument shall be >= 0
 **)

(* Functional style *)
let rec fact_1 n =
  match n with
    0 -> 1
  | n -> n * fact_1 (n - 1)
;;

(* Imperative style *)
let rec fact_2 n =
  if n = 0 then 1
  else n * fact_2 (n - 1)
;;

(* Imperative style without recursion *)
let fact_3 n =
  let result = ref 1 in
  if n > 0 then
    for i = 1 to n do result := !result * i done
  else result := 0;
  !result
;;

This revision created on Wed, 26 Sep 2012 19:25:23 by Cybercoma

Latest Revisions Edit

All content is © 2008-2024 by its respective authors. By adding content to this wiki, you agree to release it under the BSD license.