Skip to content

Instantly share code, notes, and snippets.

View kamil-adam's full-sized avatar

Kamil Adam kamil-adam

View GitHub Profile
@Garmelon
Garmelon / brainfuck.ps
Last active June 9, 2023 09:55
Brainfuck interpreter written in PostScript
% Brainfuck interpreter written in PostScript.
%
% Written in about 2 to 3 hours around midnight. This includes the time spent
% learning PostScript, which is now the first stack-based programming language
% I've actually used. Because of this, the code is pretty ugly (even for
% PostScript), but hey, it manages to correctly interpret the "Hello world"
% example from the Wikipedia page on Brainfuck.
%
% For best results, run via `ghostscript brainfuck.ps`. Enter your brainfuck
% code at the `brainfuck> ` prompt and your program input (if necessary) at the
@RaasAhsan
RaasAhsan / system.slf
Created August 15, 2020 05:02
TAPL Typed Arithmetic Expressions
package tapl;
terminals true false if then else value steporvalue Bool
syntax
t ::= true |
false |
if t then t else t
@pedrominicz
pedrominicz / Lambda.agda
Last active September 11, 2023 11:12
Programming Language Foundations in Agda: Lambda
module Lambda where
open import Relation.Binary.PropositionalEquality using (_≡_; _≢_; refl)
open import Data.String using (String; _≟_)
open import Data.Nat using (ℕ; zero; suc)
open import Data.Empty using (⊥; ⊥-elim)
open import Data.Product using (_×_; _,_)
open import Relation.Nullary using (Dec; yes; no; ¬_)
open import Data.List using (List; _∷_; [])
@PhBastiani
PhBastiani / # ArrowFreePrograms.md
Last active February 5, 2024 02:59
[Arrow-kt] For-Comprehension Free Monads in Kotlin

For-Comprehension Free Monads in Kotlin - Mini Howto

Copyright © 2020, Philippe Bastiani.
License: CC BY-NC-SA 4.0 with this restriction: this GIST could be, all or part, updated, copied, diffused for documentary purposes in the Λrrow project.

This GIST is an attempt to describe a repeatable, and automatable, process for building an embedded Domain Specific Language (DSL) with the help of a Free monad.
As material, i'll use Λrrow, the functional companion to Kotlin's Standard Library.

Disclaimer: This GIST assumes that you are roughly familiar with the concept of Free monad.

@kleczkowski
kleczkowski / church.md
Last active August 24, 2023 09:41
Kodowanie Churcha

Kodowanie Churcha

Dziś chcę opowiedzieć o kodowaniu Churcha, które jest za równo piękną konstrukcją w teorii obliczeń, jak i w praktyce.

Wymagana wiedza:

  • podstawy rachunku lambda;
  • podstawy Haskella (struktury danych, klasy typów; byłoby świetnie, gdybyś znał: dyrektywy RankNTypes, INLINE, SPECIALIZE, stream fusing).

Czym jest kodowanie Churcha?

@andypl
andypl / polecenia_git.md
Created May 27, 2019 10:28 — forked from chajr/polecenia_git.md
Polecenia GIT

Przydatne polecenia GIT

basics

  • git init - inicjalizuje repozytorium GIT w katalogu
  • git clone {adres repozytorium} - klonuje repozytorium do katalogu
  • git status - pokazuje status repozytorium (pokazuje informację o zmodyfikowanych, nowych, usuniętych oraz nie należące do repozytorium plikach)
  • git add {ścierzka do pliku} - dodaje plik do repozytorium (np. git add folder/plik.php)
  • git add -A - dodaje wszystkie nie należące do repozytorium pliki
  • git config --global color.ui auto - włącza koloryzowanie wyników w konsoli
use std::collections::HashMap;
use std::fmt;
use std::io;
use std::num::ParseFloatError;
use std::rc::Rc;
/*
Types
*/
use std::collections::HashMap;
use std::fmt;
use std::io;
use std::num::ParseFloatError;
/*
Types
*/
#[derive(Clone)]
@naoto-ogawa
naoto-ogawa / polyparse_example.hs
Last active April 10, 2020 09:45
Polyparse example
> import Text.Parse
>
-- type check
> :t word
word :: TextParser String
>
> :t runParser
runParser :: Parser t a -> [t] -> (Either String a, [t])
>
-- word
@DarinM223
DarinM223 / typeclassses.md
Last active March 31, 2023 03:35
Typeclasses in Haskell, Scala, and Rust

Type classes

Type classes have some advantages over Java style interfaces. One advantage is the ability to implement functions that do not need to take in an instance of the interface.

For example, (FromString v) takes in a String and returns v, and it doesn't have to take v as a parameter.