Jump to content

EuLisp

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Bender235 (talk | contribs) at 14:53, 10 September 2016 (clean up; HTTP→HTTPS for Github using AWB). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

EuLisp
Paradigmmulti-paradigm: functional, procedural, meta, object-oriented
FamilyLisp
First appeared1990
Preview release
0.991 / 2010
Typing disciplinestrong, dynamic
OSLinux
Filename extensions.em
Major implementations
EuXLisp [1], Youtoo [2], Eu2C [3]
Influenced by
Common Lisp, InterLisp, LeLisp, Lisp/VM, Scheme, T, CLOS, ObjVlisp, Oaklisp, MicroCeyx, MCS, Standard ML, Haskell
Influenced
Dylan, ISLISP, Evelin

EuLisp is a statically and dynamically scoped Lisp dialect developed by a loose formation of industrial and academic Lisp users and developers from around Europe. The standardizers intended to create a new Lisp "less encumbered by the past" (compared to Common Lisp), and not so minimalistic as Scheme. Another objective was to integrate the Object-oriented programming paradigm well.

Origin

Language definition process first began in a meeting in 1985 in Paris and took a long time. The complete specification and a first implementation (interpreted-only) was available in 1990.

Distinguishing features

Its primary characteristics are that it is a Lisp-1 (no separate function and variable namespaces), has a CLOS-style (Common Lisp Object System) generic-function type object-oriented system named TELOS (The EuLisp Object System) integrated from the ground up, has a built-in module system, and is defined in layers to promote the use of the Lisp on small, embedded hardware and educational machines. It supports continuations, though not as powerfully as Scheme. It has a simple lightweight process mechanism (threads).

Summary

Implementations

An early implementation of EuLisp was FEEL (Free and Eventually Eulisp). The successor to FEEL was Youtoo (interpreted and compiled versions), by University of Bath in the United Kingdom. An interpreter for the basic level of EuLisp, "level-0", was written by Russell Bradford in XScheme, an implementation of Scheme by David Michael Betz, originally called EuScheme but the most recent version is renamed EuXLisp [4] to avoid confusion. Also Eu2C [5], a EuLisp optimizing compiler, was created by Fraunhofer ISST under the APPLY project in Germany [6].

A dialect of EuLisp was developed, called Plural EuLisp; it was EuLisp with parallel programming extensions.

Example

Example use of classes in the algorithm to solve the "Towers of Hanoi" problem.

(defmodule hanoi
  (syntax (syntax-0)
   import (level-0)
   export (hanoi))

;;;-----------------------------------------------------------------------------
;;; Tower definition
;;;-----------------------------------------------------------------------------
(defconstant *max-tower-height* 10)

(defclass <tower> ()
  ((id reader: tower-id keyword: id:)
   (blocks accessor: tower-blocks)))

(defun build-tower (x n)
  (labels ((loop (i res)
                 (if (= i 0) res
                   (loop (- i 1) (cons i res)))))
          ((setter tower-blocks) x (loop n ()))
          x))

(defmethod generic-print ((x <tower>) (s <stream>))
  (sformat s "#<tower ~a: ~a>" (tower-id x) (tower-blocks x)))

;;;-----------------------------------------------------------------------------
;;; Access to tower blocks
;;;-----------------------------------------------------------------------------
(defgeneric push (x y))

(defmethod push ((x <tower>) (y <fpi>))
  (let ((blocks (tower-blocks x)))
    (if (or (null? blocks) (< y (car blocks)))
        ((setter tower-blocks) x (cons y blocks))
      (error <condition>
             (fmt "cannot push block of size ~a on tower ~a" y x)))))

(defgeneric pop (x))

(defmethod pop ((x <tower>))
  (let ((blocks (tower-blocks x)))
    (if blocks
        (progn
          ((setter tower-blocks) x (cdr blocks))
          (car blocks))
      (error <condition>
             (fmt "cannot pop block from empty tower ~a" x)))))

;;;-----------------------------------------------------------------------------
;;; Move n blocks from tower x1 to tower x2 using x3 as buffer
;;;-----------------------------------------------------------------------------
(defgeneric move (n x1 x2 x3))

(defmethod move ((n <fpi>) (x1 <tower>) (x2 <tower>) (x3 <tower>))
  (if (= n 1)
      (progn
        (push x2 (pop x1))
        (print x1 nl x2 nl x3 nl nl))
    (progn
      (move (- n 1) x1 x3 x2)
      (move 1 x1 x2 x3)
      (move (- n 1) x3 x2 x1))))

;;;-----------------------------------------------------------------------------
;;; Initialize and run the 'Towers of Hanoi'
;;;-----------------------------------------------------------------------------
(defun hanoi ()
  (let ((x1 (make <tower> id: 0))
        (x2 (make <tower> id: 1))
        (x3 (make <tower> id: 2)))
    (build-tower x1 *max-tower-height*)
    (build-tower x2 0)
    (build-tower x3 0)
    (print x1 nl x2 nl x3 nl nl)
    (move *max-tower-height* x1 x2 x3)))

(hanoi)

;;;-----------------------------------------------------------------------------
)  ;; End of module hanoi
;;;-----------------------------------------------------------------------------

References

1958 1960 1965 1970 1975 1980 1985 1990 1995 2000 2005 2010 2015 2020
 LISP 1, 1.5, LISP 2(abandoned)
 Maclisp
 Interlisp
 MDL
 Lisp Machine Lisp
 Scheme  R5RS  R6RS  R7RS small
 NIL
 ZIL (Zork Implementation Language)
 Franz Lisp
 Common Lisp  ANSI standard
 Le Lisp
 MIT Scheme
 XLISP
 T
 Chez Scheme
 Emacs Lisp
 AutoLISP
 PicoLisp
 Gambit
 EuLisp
 ISLISP
 OpenLisp
 PLT Scheme  Racket
 newLISP
 GNU Guile
 Visual LISP
 Clojure
 Arc
 LFE
 Hy
 Chialisp