Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any purely functional Schemes or Lisps?

I've played around with a few functional programming languages and really enjoy the s-expr syntax used by Lisps (Scheme in particular).

I also see the advantages of working in a purely functional language. Therefore:

Are there any purely functional Schemes (or Lisps in general)?

like image 826
nickname Avatar asked May 23 '10 01:05

nickname


People also ask

Is Lisp a purely functional language?

Strictly speaking, Lisp is a functional programming language; that is, functions are first-class objects in Lisp. However, it is not a pure-functional language such as Haskell, because operations in Lisp can have side-effects.

Is Lisp functional or procedural?

A LISP program is a function applied to data, rather than being a sequence of procedural steps as in FORTRAN and ALGOL.


1 Answers

The new Racket language (formerly PLT Scheme) allows you to implement any semantics you like with s-expressions (really any syntax). The base language is an eagerly evaluated, dynamically typed scheme variant but some notable languages built on top are a lazy scheme and a functional reactive system called Father Time.

An easy way to make a purely functional language in Racket is to take the base language and not provide any procedures that mutate state. For example:

#lang racket/base (provide (except-out (all-from-out racket/base) set! ...more here...)) 

makes up a language that has no set!.

like image 156
jonr Avatar answered Oct 06 '22 00:10

jonr