Common Lisp Some implementations perform tail-call optimization during compilation if optimizing for speed Elixir Elixir implements tail-call optimization, as do all languages currently targeting the BEAM VM. Elm Yes Erlang Yes F# F# implements TCO by default where possible Go No support Haskell Yes JavaScript ECMAScript 6.0 compliant engines should have tail calls which is now implemented on Safari/WebKit but rejected by V8 and SpiderMonkey Kotlin Has tailrec modifier for functions Lua Tail recursion is required by the language definition Objective-C Compiler optimizes tail calls when -O1 (or higher) option specified but it is easily disturbed by calls added by Automatic Reference Counting (ARC). OCaml Yes Perl Explicit with a variant of the "goto" statement that takes a function name: goto &NAME; PureScript Yes Python Stock Python implementations do not perform tail-call optimization, though a third-party module is available to do this. Language inventor Guido van Rossum contends that stack traces are altered by tail-call elimination making debugging harder, and prefers that programmers use explicit iteration instead Racket Yes Rust tail-call optimization may be done in limited circumstances, but is not guaranteed Scala Tail-recursive functions are automatically optimized by the compiler. Such functions can also optionally be marked with a @tailrec annotation, which makes it a compilation error if the function is not tail recursive Scheme Required by the language definition Tcl Since Tcl 8.6, Tcl has a tailcall command Zig Yes See also Course-of-values recursion Recursion (computer science) Inline expansion Leaf subroutine Corecursion Notes References Programming language implementation Implementation of functional programming languages Subroutines Control flow Recursion Scheme (programming language) Articles with example C code Articles with example Scheme (programming language) code pt:Recursividade (ciência da computação)#Funções recursivas em cauda es:Recursión (ciencias de computación)#Funciones de recursión de cola