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
| (define (add x y) | |
| (if (= x 0) y (add (- x 1) (+ y 1)))) |
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
| (define (add_r x y) | |
| (if (= x 0) y (+ 1 (add_r (- x 1) y)))) |
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
| 3 4 | | |
| 2 5 | time dimension of the process — CPU | |
| 1 6 | | |
| 0 7 V | |
| 7 | |
| ----> space dimension of the process — RAM |
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
| | + 1 (add_r 2 4) - | |
| | + 1 (+ 1 (add_r 1 4)) --- | |
| | + 1 (+ 1 (+ 1 (add_r 0 4))) ------> space complexity | |
| | + 1 (+ 1 (+ 1 4)) --- | |
| | + 1 (+ 1 5) - | |
| | + 1 6 | |
| V 7 |
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
| # check current badness adjustment for a PID | |
| cat /proc/<pid>/oom_score_adj | |
| # make a process nearly immune to the OOM killer | |
| # (requires CAP_SYS_RESOURCE / root) | |
| echo -900 > /proc/<pid>/oom_score_adj | |
| # make a process the preferred victim — useful for a | |
| # deliberately sacrificial "canary" process | |
| echo 1000 > /proc/<pid>/oom_score_adj |
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
| (define sq (lambda (n) (* n n))) | |
| (assert (= (sq 5) 25)) ;PASS |
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
| (define sqs (lambda (x y) (+ (sq x) (sq y)))) | |
| (assert (= (sqs 2 3) 13)); PASS |
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
| ;👇 eval operator | |
| (sqs 2 3) | |
| ;👉 (lambda (x y) (+ (sq x) (sq y))) |
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
| ;👇👇 eval operands | |
| (sqs 2 3) | |
| ; 👉 2 | |
| ; 👉 3 |
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
| ;👇 body of the procedure ;👇 arguments | |
| ;(+ (sq x) (sq y))) ; 2 3 | |
| ;applied 👉 (+ (sq 2) (sq 3)) |
NewerOlder