Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Samples for LispyScript
// All Javascript functions, objects and literals can be used in LispyScript.
(Array.prototype.forEach.call [1, 2, 3]
(function (elem index list)
(console.log elem)))
// You can access object methods and properties using the "." notation.
(console.log (.greet {greet: "hello"}))
// You can also use the 'get' expression to access a property of an object.
(console.log (get "greet" {greet: "hello"}))
(console.log (get 1 [1, 2, 3]))
// You can 'set' variables too.
(set window.onload (function () (alert "Page Loaded")))
// Now let us create a Lisp like 'let' macro in LispyScript.
(macro let (names vals rest...)
((function ~names ~rest...) ~@vals))
(let (name email tel) ("John" "john@example.org" "555-555-5555")
(console.log name)
(console.log email)
(console.log tel))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment