- start tmux:
$ tmux
- exit tmux(detach):
| sum : Tree Int -> Int | |
| sum tree = | |
| case tree of | |
| Empty -> 0 | |
| Node v left right -> | |
| v + sum left + sum right | |
| flatten : Tree a -> List a | |
| flatten tree = | |
| case tree of |
| class Rotate { | |
| public int[][] rotate(int[][] m, int s) { | |
| if(m == null || m.length == 0) return m; | |
| int w = m[0].length; | |
| int h = m.length; | |
| if(w == 1 || h == 1) return m; | |
| for(int j=0; j<s; j++) { | |
| int t1 = m[0][w-1]; |
| let a = [1, 2, 3, 4, 5]; | |
| let index = 2; | |
| let inc = amount => i => i + amount; | |
| let dec = amount => i => i - amount; | |
| let step = 1; | |
| let b = [...a.slice(0, index).map(inc(step/(a.length-1))), dec(step)(a[index]), ...a.slice(index+1).map(inc(step/(a.length-1)))]; | |
| let sum = (a, b) => a + b; | |
| console.log(a); | |
| console.log(a.reduce(sum)); | |
| console.log(b); |
| let a = [1, 2, 3, 4, 5]; | |
| let index = 2; | |
| let inc = i => i+1; | |
| let dec = i => i-1; | |
| let b = [...a.slice(0, index).map(inc), dec(a[index]), ...a.slice(index+1).map(inc)]; | |
| console.log(`a=[${a}]`); | |
| console.log(`b=[${b}]`); |
| #include "PerpetualCalendar.h" | |
| int main() { | |
| PerpetualCalendar c; | |
| //assert(c.dayofweek(10, 3, 1493) == 4); | |
| //assert(c.dayofweek(5, 20, 1493) == 1); | |
| assert(c.dayofweek(7, 4, 1776) == 4); | |
| assert(c.dayofweek(7, 14, 1789)== 2); | |
| assert(c.dayofweek(6, 18, 1815)== 7); |
| using UnityEngine; | |
| using System.Collections; | |
| public class TestCoroutine : MonoBehaviour { | |
| public void Start() | |
| { | |
| StartCoroutine("Co1"); | |
| StartCoroutine("Kill"); | |
| } |
| using UnityEngine; | |
| using System.Collections; | |
| public class Plane : MonoBehaviour { | |
| private Vector2 v = new Vector2(10, 10); | |
| /* | |
| private float radius = 50; | |
| public float GetCircumference() | |
| { |
| using System; | |
| using System.Threading; | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using System.Diagnostics; | |
| class Time | |
| { | |
| public static float deltaTime; | |
| } |
| using System.Collections.Generic; | |
| using System.Collections; | |
| class Array | |
| { | |
| public static void Main() | |
| { |