Skip to content

Instantly share code, notes, and snippets.

@crcx
Forked from anonymous/gist:4979866
Last active December 13, 2015 21:48
Show Gist options
  • Save crcx/4979875 to your computer and use it in GitHub Desktop.
Save crcx/4979875 to your computer and use it in GitHub Desktop.
"Various Geometric Conversions"
[ #0.0174532925 * ] 'degrees-to-radians' define
'( degrees - radians )\nConvert degrees to radians' 'degrees-to-radians' describe
[ #0.0174532925 / ] 'radians-to-degrees' define
'( radians - degrees )\nConvert radians to degrees' 'radians-to-degrees' describe
[ #3.14159 ] 'pi' define
'( - number )\nConstant; value for PI' 'pi' describe
[ "diameter" pi * ] 'circumference' define
'( diameter - circumference )\nCalculate the circumference of a circle' 'circumference' describe
[ "radius" dup * pu * ] 'area-of-circle' define
'( radius - area )\nCalculate the area of a circle' 'area-of-circle' describe
[ "base height" * #0.5 * ] 'area-of-triangle' define
'( base height - area )\nCalculate the area of a triangle' 'area-of-triangle' describe
[ "length width" * ] 'area-of-rectangle' define
'( length width - area )\nCalculate the area of a rectangle' 'area-of-rectangle' describe
[ "side" dup * ] 'area-of-square' define
'( side - area )\nCalculate the area of a square' 'area-of-square' describe
"Temperature Conversions"
[ #273.15 + ] 'celsius-to-kelvin' define
[ #459.67 + #9 #5 / * ] 'farenheit-to-kelvin' define
[ #9 #5 / * #32 + ] 'celsius-to-farenheit' define
[ #32 - #9 #5 / * ] 'farenheit-to-celsius' define
[ #273.15 - ] 'kelvin.asCelsius' define
[ #9 #5 / * #459.67 - ] 'kelvin.asFarenheit' define
[ #0 ] 'kelvin.absolute-zero' define
[ #273.15 ] 'kelvin.ice-melts-at' define
[ #273.16 ] 'kelvin.triple-point-of-water' define
[ #288 ] 'kelvin.average-surface-temperature' define
[ #310 ] 'kelvin.average-human-body-temperature' define
[ #373.1339 ] 'kelvin.water-boils' define
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment