This file contains hidden or 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 sympy import * | |
| from sympy.physics.quantum import TensorProduct | |
| # composition is '*' | |
| # monoidal product | |
| def T(*args): | |
| if len(args) == 0: return Matrix([[1]]) | |
| elif len(args) == 1: return args[0] | |
| else: return TensorProduct(*args) |
This file contains hidden or 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
| datatype 'a tree = Item of 'a | Section of 'a tree list | |
| datatype 'a path = Top | Node of 'a tree list * 'a path * 'a tree list | |
| exception zipper_exn of string | |
| fun mk_zipper (t: 'a tree) = (t, Top : 'a path) | |
| fun go_left (_, Top) = raise zipper_exn "cannot go left from Top" | |
| | go_left (t, Node(l::left,up,right)) = (l, Node(left,up,t::right)) | |
| | go_left (_, Node([],_,_)) = raise zipper_exn "cannot go left from leftmost child" |
This file contains hidden or 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
| #!/usr/bin/env ruby | |
| # | |
| # Usage: | |
| # security dump-keychain -d login.keychain > keychain_logins.txt | |
| # # Lots of clicking 'Always Allow', or just 'Allow', until it's done... |