Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mvasilkov
Created August 19, 2014 09:01
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 mvasilkov/1f51620ad126604781ff to your computer and use it in GitHub Desktop.
Save mvasilkov/1f51620ad126604781ff to your computer and use it in GitHub Desktop.
Math.sin macro
macro _sin {
case { _($x:lit) } =>
{
var res = Math.sin(unwrapSyntax(#{ $x }))
return [makeValue(res, #{ $x })]
}
case { _($x) } =>
{
return #{ Math.sin($x) }
}
}
var a = _sin(0.5)
///////////
var x = 0.5
var b = _sin(x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment