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
// From https://artsy.github.io/blog/2018/11/21/conditional-types-in-typescript/ | |
// Includes extra exercises. | |
type Action = | |
| { | |
type: "INIT" | |
} | |
| { | |
type: "SYNC" | |
} |
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
#ifdef __cplusplus | |
#define CCALL extern "C" | |
CCALL RF24* rf24_init(uint8_t ce_pin, uint8_t cs_pin) { return new RF24(ce_pin, cs_pin); } | |
CCALL void rf24_begin(RF24* rf24) { rf24->begin(); } | |
CCALL void rf24_free(RF24* rf24) { delete rf24; } | |
#else | |
typedef struct {} RF24; |
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
; f -> x -> x | |
(def zero | |
(fn [f,x] x)) | |
; 1: f -> x -> f(x) | |
(def one | |
(fn [f,x] (f x))) | |
; 2: f -> x-> f(f(x)) | |
(def two |