Skip to content

Instantly share code, notes, and snippets.

@dalmaer
Created June 20, 2012 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dalmaer/2960736 to your computer and use it in GitHub Desktop.
Save dalmaer/2960736 to your computer and use it in GitHub Desktop.
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