This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::ptr::NonNull; | |
| use std::ops::{Deref, Drop}; | |
| use std::mem::{MaybeUninit, ManuallyDrop}; | |
| use std::sync::atomic::{AtomicUsize, Ordering}; | |
| #[derive(Debug)] | |
| pub struct StaticArc<T> { | |
| inner: NonNull<StaticArcInner<T>>, | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // no, this is not that useful | |
| package main | |
| import ( | |
| "fmt" | |
| "unsafe" | |
| ) | |
| type Kind[T any] struct{} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE NumericUnderscores #-} | |
| module Bitlang | |
| ( compile | |
| , evaluate | |
| , generate | |
| , ImageMeta(..) | |
| , ExprMeta(..) | |
| , Depth(..) | |
| ) where |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "unsafe" | |
| ) | |
| // size = 8 + 8 = 16 | |
| type TaggedUnion struct { | |
| Kind uintptr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::time::SystemTime; | |
| fn main() { | |
| let state = measure(alloc); | |
| let _clone = measure(|| clone(&state)); | |
| } | |
| #[inline] | |
| fn measure<T, F: Fn() -> T>(f: F) -> T { | |
| let start = SystemTime::now(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def match(value, clauses): | |
| for m in clauses: | |
| try: | |
| exec(f'{m} = {value}') | |
| return clauses[m](locals()) | |
| except (TypeError, ValueError): | |
| continue | |
| raise ValueError('non exhaustive patterns') | |
| def main(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (define-record generation (num cols rows board)) | |
| (define (board-at g x y) | |
| (let | |
| ([board (generation-board g)] | |
| [cols (generation-cols g)]) | |
| (fxvector-ref board (+ (* y cols) x)))) | |
| (define (board-set! g x y value) | |
| (let |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| macro_rules! p { | |
| ($x:expr, $y:expr) => { Point { x: $x, y: $y } } | |
| } | |
| #[derive(Debug, Copy, Clone)] | |
| struct Point { | |
| x: f32, | |
| y: f32, | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| BOOK_GEN=50 | |
| BOOK_EXO=40 | |
| BOOK_LEV=27 | |
| BOOK_NUM=36 | |
| BOOK_DEU=34 | |
| BOOK_JOS=24 | |
| BOOK_JUI=21 | |
| BOOK_RUT=4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from functools import reduce | |
| def last(iterator): | |
| item = None | |
| for x in iterator: | |
| item = x | |
| return item | |
| def deplete(iterator): | |
| for x in iterator: |