Code Snippets Standard ML

Short texts Standard ML 🧑‍💻 Code snippets Standard ML ✍️ Reading lists Standard ML 👀

OpenPGP key transition statement

Date: 08 September 2021 Over the last decade I have been trying to grasp over what OpenPGP and GnuPG actually are. I was not sure about how’s and why’s of the technology, which is why I have accumulated a lot of various OpenPGP keys. Some of them are too small, some are long expired, some […]

A polyglot summation challenge

The summation challenge, extended from the classical a-plus-b problem, is a programming challenge for beginners. A programmer is asked to write a program to read multiple integers separated by whitespace from a single line and then print out their sum. Although not difficult, different solutions to this problem can exhibit different characteristics of programming languages. […]

fixpoints.ml

(* Credits to Avery Cowan for this one! *) datatype ‘a self = Self of (‘a self -> ‘a) (* Given an ‘a self -> ‘a function, we can get an ‘a * (kinda weird, right?) *) fun fix (x : ‘a self -> ‘a) : ‘a = x (Self x) (* Here’s an example: […]

Simple tests for Hw3 challenge problem (coursera/programming-languages)

(* Homework3 challenge problem simple test *) (* Source of test cases: https://www.coursera.org/learn/programming-languages/supplement/FEymH/hints-and-gotchas-for-section-3 *) use “hw3.sml”; val challenge_test1 = typecheck_patterns ( [], [ConstP 10, Variable “a”] ) = SOME IntT val challenge_test2 = typecheck_patterns ( [], [ ConstP 10, Variable “a”, ConstructorP(“SOME”,Variable “x”) ] ) = NONE val challenge_test3 = typecheck_patterns ( [], [ TupleP[Variable […]