This file contains 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
<?php | |
class Velocity { | |
public function __construct (PayoffCalc $PayoffCalc) | |
{ | |
$this->_PayoffCalc = $PayoffCalc; | |
} | |
public function toFloat() | |
{ | |
$paymentPerDay = $this->_PayoffCalc->getPaymentPerDay(); |
This file contains 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
def doCalc () | |
return 1 + 2 | |
end | |
def doAwesome (x) | |
return doCalc() + x | |
end | |
#before substitution... | |
def test () | |
return doAwesome(3) |
This file contains 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
;; trace-forms "Trace all the forms in the given body. Returns any | |
;; underlying uncaught exceptions that may make the forms fail." | |
(trace-forms | |
(let [a (+ 1 1) | |
b (* 2 2) | |
c (* a b (/ 4 0))] | |
c)) | |
;; => ArithmeticException Divide by zero | |
;; Form failed: (/ 4 0) | |
;; Form failed: (* a b (/ 4 0)) |
This file contains 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
;; example up from clouredocs.org: | |
;; http://clojuredocs.org/clojure_contrib/clojure.contrib.trace/deftrace | |
(deftrace fib [n] | |
(if (or (= n 0) (= n 1)) | |
1 | |
(+ (fib (- n 1)) (fib (- n 2))))) | |
(fib 4) | |
;; => 5 | |
;; 1> TRACE t2742: (fib 4) |
This file contains 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
if workday(today()) do | |
x = 1 + 1 | |
else | |
x = doOtherHugeCalc() | |
end |
This file contains 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
def ifworkday(first, second) | |
if workday(today()) do | |
return first | |
else | |
return second | |
end | |
end | |
x = ifworkday(1 + 1, doOtherHugeCalc()) | |
#when the values are “shown” |
This file contains 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
#if it is a macro... | |
defmacro ifworkday(first, second) | |
if workday(today()) do | |
return first | |
else | |
return second | |
end | |
end | |
ifworkday(1+1, doOtherHugeCalc()) |
This file contains 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
‘(a b c d) | |
;;=> (a b c d) |
This file contains 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
(= ‘a ‘a) | |
;;=> true |
This file contains 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
(= a a) | |
;; => java.lang.Exception: Unable to resolve symbol: a in this context |
OlderNewer