View ondulator.html
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Ondulator</title>
<script>
const PI = Math.PI;
const TAU = 2 * PI;
View Fruits.hs
import Data.SBV
fruits :: SInteger -> SInteger -> SInteger -> SBool
fruits a b c = equation &&& positive
where
x = sFromIntegral a :: SReal
y = sFromIntegral b :: SReal
z = sFromIntegral c :: SReal
equation = x / (y + z) + y / (x + z) + z / (x + y) .== 4
View Circle.hs
import Control.Monad
import Math.NumberTheory.Logarithms (integerLog2)
simulate :: Integer -> Integer
simulate n = head (go [1..n])
where
go [x] = [x]
go (x1:x2:xs) = go (xs ++ [x1])
View out_of_process.py
def out_of_process(func):
from types import GeneratorType
GENERATOR = b'#GENERATOR#'
DONE = b'#DONE#'
def runner(conn, *args, **kwargs):
return_value = func(*args, **kwargs)
if isinstance(return_value, GeneratorType):
conn.send(GENERATOR)
for val in return_value:
View wrap_wrap.cpp
#include <type_traits>
template <typename T>
struct wrap;
template <typename T>
constexpr auto is_wrap_v = false;
template <typename T>
constexpr auto is_wrap_v<wrap<T>> = true;
View JavaStringMemchr.java
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import sun.misc.Unsafe;
import java.lang.reflect.Field;
public class Program {
private static final Unsafe UNSAFE;
View novice-tuple.cpp
#include <utility>
#include <type_traits>
template<typename T>
struct identity { using type = T; };
template<std::size_t I, typename... Ts>
struct nth_type;
template<typename T, typename... Ts>
View devirt2.cpp
#include <array>
#include <typeinfo>
extern volatile int poop;
struct A {
virtual void f() { poop += 10; }
};
struct B : public A {
View method_choice.cpp
#include <utility>
template<typename T, T... PMFs>
struct method_choice;
template<typename C, typename R, R C::* PMF, R C::*... PMFs>
struct method_choice<R C::*, PMF, PMFs...> {
template<typename... A>
method_choice(int choice, C &subject, A... args) {
if (choice == 0) {
View leaking.cpp
#include <algorithm>
#include <iostream>
#include <memory>
#include <typeinfo>
#include <vector>
#include <cassert>
using namespace std;
template <typename T>