This file contains 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::{ | |
fs, | |
num::{NonZeroU8, NonZeroUsize}, | |
path::Path, | |
}; | |
use regex::Regex; | |
macro_rules! entries { | |
() => {}; |
This file contains 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
pub(crate) fn parse_hex(buffer: &[u8]) -> Result<usize, ()> { | |
let mut output = 0; | |
let buf_len = buffer.len(); | |
for (idx, chr) in buffer.iter().copied().enumerate() { | |
let shl = 4 * (buf_len - idx - 1); | |
match chr { | |
alpha @ b'a'..=b'f' => { | |
output += (10_usize + (alpha - b'a') as usize) << shl; | |
} |
This file contains 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
pub(crate) fn parse_hex(buffer: &[u8]) -> FeedingResult<usize> { | |
let mut output = 0; | |
const fn naive_upper(v: u8) -> u8 { | |
v & !(0x20 * (v >= b'A') as u8) | |
} | |
// !{char} = incorrect | |
const TABLE: &[usize] = &[ |
This file contains 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
import Data.Char ( isDigit ) | |
import qualified Data.Map as M | |
import qualified Data.Bifunctor as Bi | |
import Prelude hiding ( scope, lookup ) | |
data BType = Open | Close | |
deriving Show | |
newtype Operator = Operator String |
This file contains 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 adaptix import Retort | |
from typing import Literal | |
from dataclasses import dataclass | |
from io import IOBase | |
@dataclass(frozen=False, slots=True) | |
class InputMediaVideo: | |
"""Represents a video to be sent.""" |
This file contains 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
module LambdellCalculus where | |
import qualified Data.Bifunctor as Bi | |
data Term = ApplyT Term Term | |
| VarT Char | |
| FunT Char Term | |
deriving(Show, Eq) | |
isValidVar :: Char -> Bool |
This file contains 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
module Number where | |
data Nat = S Nat | Z | |
deriving(Eq) | |
natIntoHaskellInt :: Nat -> Int | |
natIntoHaskellInt Z = 0 | |
natIntoHaskellInt (S v) = natIntoHaskellInt v + 1 | |
instance Show Nat where |
This file contains 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
module JsonParser where | |
import qualified Data.Map as M | |
import qualified Data.Bifunctor as Bi | |
import Data.Char ( ord | |
, chr | |
, isHexDigit | |
, isDigit | |
) |
This file contains 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
trait Nat { | |
type Succ; | |
const NUMERIC: u64; | |
} | |
struct S<T>(T); | |
struct Z; | |
impl Nat for Z { |
This file contains 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
trait Lam<X> { | |
type Result; | |
} | |
struct True0; | |
struct True1<X>(X); | |
struct False0; | |
struct False1<X>(X); |
OlderNewer