// computing
C_bool = (A : Type) -> A -> A -> A;
(c_true : C_bool) = A => t => f => t;
(c_false : C_bool) = A => t => f => f;
// induction
I_bool b = (P : C_bool -> Type) -> P c_true -> P c_false -> P b;
i_true : I_bool c_true = P => p_t => p_f => p_t;
i_false : I_bool c_false = P => p_t => p_f => p_f;
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
import { | |
Metadata, | |
MasterEdition, | |
CreateMetadataV2, | |
DataV2, | |
CreateMasterEditionV3, | |
} from "@metaplex-foundation/mpl-token-metadata"; | |
const BN = require("bn.js"); |
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
// Every req.body.{} is from Postman | |
const nftAddress = await new web3.PublicKey(req.body.nftAddress); | |
const getNftATA = await spl.Token.getAssociatedTokenAddress( | |
spl.ASSOCIATED_TOKEN_PROGRAM_ID, | |
spl.TOKEN_PROGRAM_ID, | |
nftAddress, | |
mintAuthority.publicKey | |
); |
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
/// <reference types="node" /> | |
/// Locale: node_modules/@metaplex-foundation/mpl-token-metadata/dist/src/accounts/Metadata.d.ts | |
import { Borsh, Account, AnyPublicKey, StringPublicKey } from '@metaplex-foundation/mpl-core'; | |
import { AccountInfo, Connection, PublicKey } from '@solana/web3.js'; | |
import { Buffer } from 'buffer'; | |
import { Edition } from './Edition'; | |
import { MasterEdition } from './MasterEdition'; | |
import { Uses } from './Uses'; |
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
type Reverse<A> = | |
`${A}` extends `${infer AH}${infer AT}` | |
? `${Reverse<AT>}${AH}` : A | |
type Digs = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | |
type DigsNext<I = Digs, R = {}> = | |
I extends [infer Head, infer Next, ...infer Tail] |
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
type Props = { | |
length: number; | |
arr: number[]; | |
} | |
function insertionSort(arr: Props['arr']) { | |
for (let i = 1; i < arr.length; i++) { | |
let currentVal = arr[i]; | |
for (var j = i - 1; j >= 0 && arr[j] > currentVal; j--) { | |
arr[j + 1] = arr[j]; |
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
type TRUE = <A>(a: A) => <B>(b: B) => A; | |
type FALSE = <A>(a: A) => <B>(b: B) => B; | |
type OR = <A extends TRUE | FALSE>(a: A) => <B extends TRUE | FALSE>(b: B) => TRUE | FALSE; | |
// (λx.λy.x) | |
const TRUE: TRUE = a => b => a; | |
console.log(TRUE(1)(0)); | |
// (λx.λy.y) | |
const FALSE: FALSE = a => b => b; |
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
let one = (f) => (x) => f(x) // (λf.λx.f x) | |
let two = (f) => (x) => f(f(x)) // (λf.λx.f (f x)) | |
let _succ = (n) => (f) => (x) => f(n(f)(x)) // (λn.λf.λx.f (n f x)) | |
let _add = (m) => (n) => (f) => (x) => m(f)(n(f)(x)) // (λm.λn.λf.λx.m f (n f x)) | |
let _mult = (m) => (n) => (f) => (x) => m(n(f))(x) // (λm.λn.λf.λx.m (n f) x) | |
let _exp = (m) => (n) => (f) => (x) => n(m)(f)(x) // (λm.λn.λf.λx.n m f x) | |
let _pred = (n) => (f) => (x) => n((g) => (h) => h(g(f)))(u => x)(u => u) // (λn.λf.λx.n (λg.λh.h (g f)) (λu.x) (λu.u)) | |
let _sub = (m) => (n) => n(_pred)(m) // (λm.λn.n pred m) |
Ler e entender um pouco desse artigo. https://wiki.c2.com/?FeynmanAlgorithm
- Reconhecer como você pensa
- Descrever métodos que você usa para pensar
- Entender métodos diferentes de pensar
- Fazer perguntas sobre tudo(incluindo sobre perguntas)