Skip to content

Instantly share code, notes, and snippets.

@fay59
fay59 / deriv.swift
Last active December 29, 2017 00:19 — forked from jdh30/deriv.swift
Swift code to compute the nth derivative of x^x
precedencegroup ExponentPrecedence {
associativity: right
higherThan: MultiplicationPrecedence
}
infix operator **: ExponentPrecedence
fileprivate enum Expr: CustomStringConvertible {
case Int(n: Int)
indirect case Var(x: String)