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
(** This is a demonstration of implementing interpreters in an extensible way | |
that offers a partial solution to the expression problem. The idea is that | |
the language can be extended with more features after the fact, without | |
altering previous definitions. It also has the benefit of grouping the | |
related extensions to the syntax and semantic domains together with the | |
relevant evaluation rules in a per-feature way. | |
This approach used is similar to the one described by Matthias Blume in | |
{{:https://www.microsoft.com/en-us/research/video/records-sums-cases-and-exceptions-row-polymorphism-at-work/} | |
Records, sums, cases, and exceptions: Row-polymorphism at work}. |
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
/////////////////////////////////////////////////////////////////////////////// | |
// ABOUT: A unity Shader .cginc to draw numbers in the fragment shader | |
// AUTHOR: Freya Holmér | |
// LICENSE: Use for whatever, commercial or otherwise! | |
// Don't hold me liable for issues though | |
// But pls credit me if it works super well <3 | |
// LIMITATIONS: There's some precision loss beyond 3 decimal places | |
// CONTRIBUTORS: yes please! if you know a more precise way to get | |
// decimal digits then pls lemme know! | |
// GetDecimalSymbolAt() could use some more love/precision |
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
class BritishNaming(type): | |
def __new__(mcs, *args): | |
cls = super().__new__(mcs, *args) | |
cls.__init__ = cls.__innit__ | |
return cls | |
class MyBritishClass(metaclass=BritishNaming): | |
def __innit__(self): | |
print("I am british now ig") |
\b(?:(?<fizzbuzz>(?:(?:[369]|[258][0369]*[147]|(?:[147]|[258][0369]*[258])(?:[0369]|[147][0369]*[258])*(?:[28]|[147][0369]*[147]))*(?:0|(?:[147]|[258][0369]*[258])(?:[0369]|[147][0369]*[258])*5))+)|(?<buzz>\d*[05])|(?<fizz>(?:[0369]|[258][0369]*[147]|(?:[147]|[258][0369]*[258])(?:[0369]|[147][0369]*[258])*(?:[258]|[147][0369]*[147]))+))\b
insanity, as i'd like to call it. although it isn't fizzbuzz per se, it's the best you can get with regex. here's a regexr link to it with sample text.
this matches a number (within word boundaries) if it falls under any of the three groups:
fizzbuzz
, which picks up numbers divisible by both 3 and 5, i.e. 15;buzz
, which picks up numbers divisible by 5; andfizz
, which picks up numbers divisible by 3.
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
{-# LANGUAGE UndecidableInstances #-} | |
module Hylo where | |
-- An attempt to derive a hylomorphism from the type signature (at the time of | |
-- writing I don't recall ever seeing the implementation of one). | |
type Algebra f a = f a -> a | |
type Coalgebra f a = a -> f a |
The originality of these Gists varies drastically. Most are inspired by the work of others, in that case, all merit goes to the original authors. I have linked everything used as reference material on the Gists themselves.
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
According to all known laws of aviation, there is no way a bee should be able to fly. | |
Its wings are too small to get its fat little body off the ground. | |
The bee, of course, flies anyway because bees don't care what humans think is impossible. | |
Yellow, black. Yellow, black. Yellow, black. Yellow, black. | |
Ooh, black and yellow! | |
Let's shake it up a little. | |
Barry! Breakfast is ready! | |
Coming! | |
Hang on a second. | |
Hello? |
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 Printf | |
%default total | |
-- Formatting AST. | |
data Format | |
= FInt Format | |
| FString Format | |
| FOther Char Format | |
| FEnd |
NewerOlder