/EmotionalHub

The interactive programming language for education and entertainment.

Primary LanguageJavaScript

EmotionalHub

Build Status

EmotionalHub is the interactive programming platform for amusement and education with Emola.

Emola is a kind of LISP programming language designed by ymizushi.

Try Emola

Setup

See SETUP.md

Screenshot

alt text alt text

Emola Language Specification

Arithmetic operator

(+ 1 1 1) ; Emola=> 3
(- 2 1 1) ; Emola=> 0
(* 2 2 2) ; Emola=> 8
(/ 4 2 2) ; Emola=> 1
(/ 1 3)   ; Emola=> 0.3333333333333333 
(= 2 2)   ; Emola=> true 
(= 2 1)   ; Emola=> false 
(>= 1 1)  ; Emola=> true 
(> 1 1)   ; Emola=> false 
(<= 1 1)  ; Emola=> true 
(< 1 1)   ; Emola=> false 

Binding

(def hoge 1)
hoge
;Emola=> 1

Defiinition of function

(defn calc (x y)
  (* x y))
(calc 2 3)
;Emola=> 6

Local binding

(defn calc (x)
  (let (y 1 z 2)
    (* x y z)))
(calc 3)
;Emola=> 6

If

(defn calc (x)
  (if (= x 1)
    true
    false))
(calc 1)
;Emola=> true
(calc 2)
;Emola=> false

Evaluates the expressions in order.

(do 
  (def hoge 1)
  (+ hoge 1))
;Emola=> 2

Message passing

(send (point 100 100) toString)
;Emola=> {x: 100, y: 100}

Call Javascript built-in function

(send (window) alert 1)

Create Circle

(def c (circle (point 100 100) 200 (color 100 100 100)))
(draw c)

Create Rectangle

(def r (rect (point 100 100) (size 100 100) (color 0 255 0)))
(draw r)

Create Line

(def l (line (point 100 100) (point 1000 1000)))
(draw l)

Create Text

(def t (text "hoge" (point 100 100) (color 50 50 50)))
(draw t)

Clear graphic context

(clear)