Skip to content

Instantly share code, notes, and snippets.

Avatar

Victor Taelin VictorTaelin

  • Kindelia Foundation
  • Rio de Janeiro, Brazil
  • Twitter @VictorTaelin
View GitHub Profile
View aula.hvm
//// Aplicar Scott = Pattern Match
//(n
//// case succ
//λpred(...)
//// case zero
//case_zero
//)
//// Aplicar Church = Fold Recursivo
@VictorTaelin
VictorTaelin / foo.hvm
Created Oct 26, 2022
A configurable busy function meant to test parallel implementations
View foo.hvm
// A configurable busy function meant to test parallel implementations
// - 1st arg = parallel recursion depth
// - 2nd arg = sequential recursion length
(Foo 0 0) = 1
(Foo 0 m) = (Foo 0 (- m 1))
(Foo n m) = (+ (Foo (- n 1) m) (Foo (- n 1) m))
View 12-bit-unsigned-floating-point-values.txt
This table shows all the values that a 12-bit unsigned floating point can store,
given that 4 bits are used for the exponent, and 8 bits for the mantissa.
E | M | value
- | -- | -----
0 | 00 | 1
0 | 01 | 1.00390625
0 | 02 | 1.0078125
0 | 03 | 1.01171875
0 | 04 | 1.015625
@VictorTaelin
VictorTaelin / inc_comparison.md
Created Jul 6, 2022
Inc contract comparison, Ethereum vs Kindelia
View inc_comparison.md

Ethereum

Deploy contract:

Code:

pragma solidity >=0.4.22 <=0.9.0;
View rollback_state_list.js
function push(new_state, states) {
if (states === null) {
return {keep: 0, life: 0, state: new_state, older: null};
} else {
var {keep, life, state, older} = states;
if (keep === 0) {
return {keep: 1, life, state, older};
} else {
if (life > 0) {
return {keep: 0, life: 0, state: new_state, older: {keep: 0, life: life - 1, state, older}};
View global_ids_kindelia_name_system.txt
GLOBAL IDS
==========
Todos os usuários da rede são endereçados por um ID global único.
Um ID global tem 120 bits. Existem dois tipos:
Usuários Internos
-----------------
São usuários controlados por um contrato na rede.
@VictorTaelin
VictorTaelin / kindelia_presale_proposal_namespace_solution.md
Last active Jun 19, 2022
Kindelia Presale Proposal / Namespace Solution
View kindelia_presale_proposal_namespace_solution.md

Kindelia Presale Proposal

O problema

Nos últimos dias, temos discutido sobre como fazer um fund-raising bem-sucedido e, principalmente, honesto para o Kindelia, considerando que a rede não possui um token nativo, e que, mesmo se possuísse, fazer uma ICO atualmente traz diversas implicações legais. Das diversas ideias levantadas, acho que uma boa

@VictorTaelin
VictorTaelin / hvm.rs
Created Apr 23, 2022
Self-Contained HVM as a single Rust file with no FreeList
View hvm.rs
#![allow(clippy::identity_op)]
#![allow(dead_code)]
#![allow(non_snake_case)]
use std::collections::{hash_map, HashMap};
use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher};
use rand::prelude::*;
use std::time::Instant;
View solucion.js
function push(new_state, states) {
if (states === null) {
return {bit: 0, state: new_state, older: null};
} else {
var {bit, state, older} = states;
if (bit === 0) {
return {bit: 1, state, older};
} else {
return {bit: 0, state: new_state, older: push(state, older)};
}
View quacksort.hs
-- merge + quick sort
-- quite good for random or semi-sorted lists
-- terrible for reverse sorted lists
import Debug.Trace
import Data.List
import Data.Word
randomList :: Word32 -> Word32 -> [Word32]
randomList seed 0 = []