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
(defmacro infix | |
[infixed] | |
(list (second infixed) | |
(first infixed) | |
(last infixed))) | |
(infix (1 + 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
(defmacro unless [conditional & body] | |
`(if (not ~conditional) | |
(do ~@body))) | |
;; => #'unless | |
(unless false "Hello JCConf") | |
;; => "Hello JCConf |
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
(def numbers [1 2 3]) | |
;; => #'numbers | |
(conj numbers 4) | |
;; => [1 2 3 4] | |
numbers | |
;; => [1 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
;; Lists | |
'(1 2 3 4 5) | |
'(:foo :bar 2) | |
;; Vectors | |
[:foo :bar] | |
[3 4 5 nil] | |
;; Maps | |
{:foo "bar", :baz 2} |
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
;; Numbers | |
23 | |
-100 | |
1.7 | |
-2 | |
33e8 | |
;; Keywords | |
:foobar | |
:2 |
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
(inc 1) | |
;; => 2 | |
(+ 1 2 3 4) | |
;; => 10 | |
((fn [x] (* x x)) 5) | |
;; ==> 25 | |
(def square (fn [x] (* x x))) |
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
#include <iostream> | |
#include <cmath> | |
#include <chrono> | |
uint32_t num_calls = 0; // to fool optimizer | |
namespace constants | |
{ | |
constexpr const auto time_step = 0.01; | |
constexpr const auto num_samples = 100000; |
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
#include <iostream> | |
#include <cstdlib> | |
#include <stdio.h> | |
#include <math.h> | |
#include <array> | |
using namespace std; | |
int main() | |
{ | |
double dt = 0.01; |
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
(inc 1) | |
(map inc [1 2 3]) | |
(.getElementById js/document "app") | |
(defn average [a b] | |
(/ (+ a b) 2.0)) |
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
;; Numbers | |
23 | |
-100 | |
1.7 | |
-2 | |
33e8 | |
;; Keywords | |
:foobar | |
:2 |