Add tasks for all the new languages

This commit is contained in:
Tina Müller 2016-12-05 23:44:36 +01:00
parent 9dc3c2bb62
commit bba7bfd280
13208 changed files with 134745 additions and 0 deletions

View file

@ -0,0 +1,31 @@
(defmodule simple-object
(export all))
(defun fish-class (species)
"
This is the constructor used internally, once the children and fish id are
known.
"
(let ((habitat '"water"))
(lambda (method-name)
(case method-name
('habitat
(lambda (self) habitat))
('species
(lambda (self) species))))))
(defun get-method (object method-name)
"
This is a generic function, used to call into the given object (class
instance).
"
(funcall object method-name))
; define object methods
(defun get-habitat (object)
"Get a variable set in the class."
(funcall (get-method object 'habitat) object))
(defun get-species (object)
"Get a variable passed when constructing the object."
(funcall (get-method object 'species) object))

View file

@ -0,0 +1,8 @@
> (slurp '"simple-object.lfe")
#(ok simple-object)
> (set my-fish (fish-class '"Carp"))
#Fun<lfe_eval.10.91765564>
> (get-habitat my-fish)
"water"
> (get-species my-fish)
"Carp"