Ethereum
Deploy contract:
Code:
pragma solidity >=0.4.22 <=0.9.0;
//// Aplicar Scott = Pattern Match | |
//(n | |
//// case succ | |
//λpred(...) | |
//// case zero | |
//case_zero | |
//) | |
//// Aplicar Church = Fold Recursivo |
// 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)) |
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 |
pragma solidity >=0.4.22 <=0.9.0;
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}}; |
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. |
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
#![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; |
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)}; | |
} |
-- 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 = [] |