Skip to content

Instantly share code, notes, and snippets.

View shinkwhek's full-sized avatar
🌊

Shin.K shinkwhek

🌊
  • Azkaban
View GitHub Profile
// https://github.com/oreilly-japan/conc_ytakano/tree/main/chap3/3.9
use std::ptr::{read_volatile, write_volatile};
use std::sync::atomic::{fence, Ordering};
use std::thread;
const NUM_THREADS: usize = 4;
const NUM_LOOP: usize = 100000;
macro_rules! read_mem {

Keybase proof

I hereby claim:

  • I am shinkwhek on github.
  • I am shinkwhek (https://keybase.io/shinkwhek) on keybase.
  • I have a public key ASCYt6jZAYcLukjAJ7pzOFDbEMqp4q0D6zieFooIYFrfGAo

To claim this, I am signing this object:

@shinkwhek
shinkwhek / form_light.elm
Created September 15, 2019 16:21
form light
-- Input a user name and password. Make sure the password matches.
--
-- Read how it works:
-- https://guide.elm-lang.org/architecture/forms.html
--
import Browser
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (onInput, onClick)
@shinkwhek
shinkwhek / Program.fs
Last active September 15, 2019 08:57
state monad
open FSharpPlus
type NewList<'a> =
| Nil
| Cons of 'a * NewList<'a>
type Monadic<'a, 'b> =
| Monadic of ('a -> ('b * 'a))
static member Return x = Monadic(fun c -> (x, c))
static member (>>=) (Monadic f, g) =
-- Input a user name and password. Make sure the password matches.
--
-- Read how it works:
-- https://guide.elm-lang.org/architecture/forms.html
--
import Browser
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (onInput, onClick)
trait Monad<A, MA> {
fn _return(a: A) -> MA;
fn _bind<F>(self, f: F) -> MA
where
F: Fn(A) -> MA;
}
#[derive(Debug, PartialEq)]
enum Maybe<T> {
Just(T),