Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kalimehtar/message-oo

Message-passing Smalltalk-style object system
https://github.com/kalimehtar/message-oo

Last synced: about 1 month ago
JSON representation

Message-passing Smalltalk-style object system

Awesome Lists containing this project

README

        

Message OO
==========

This package gives you the great opportunity of real object-oriented
programming.

For example, you may write

(use-package :message-oo)

(defmessage list (:add item) (append list (list item)))
(defmessage list (:map func) (mapcar func list))
(defmessage list (:reduce func) (reduce func list))
(defmessage number (:+ number2 &rest numbers)
(apply '+ number number2 numbers))

(@ nil
(:add 1)
(:add 2)
(:add 3)
(:map (@ '(:+ 3) :fn))
(reduce #'+)) => 15

You may think of last command as nil.add(1).add(2).add(3).map(..).reduce(...)

Every next step is applied to the result of previous as in UNIX shell pipeline.

Enjoy!