Created
May 24, 2013 16:10
-
-
Save hhc0null/5644580 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Calc a distance of a thrown object | |
(define pi (* 4 (atan 1.0))) ; pi = 4atan(-1) | |
(define gravaccr 9.8) ; gravitial accelaration | |
(define CalcDistance | |
(lambda (v0 deg) | |
(define DegreeToRadian | |
(lambda (degree) | |
(/ (* degree pi) 180))) | |
(define CalcDistanceX | |
(lambda (vx t) | |
(* vx t))) | |
(define CalcTimeY | |
(lambda (vy) | |
(/ (* 2 vy) gravaccr ))) | |
(define t | |
(CalcTimeY (* v0 (sin (DegreeToRadian deg))))) | |
(* (CalcDistanceX (* v0 (cos (DegreeToRadian deg))) t)))) | |
(display (CalcDistance 40 30)) ; display the result | |
(display "\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment