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
(* Spread and fan prefix intersections. *) | |
From intuitionism Require Import lib set seq bcp spr fan. | |
(* Finite sequence comparison. *) | |
Section FiniteCompare. | |
(* Check if two sequences have a shared prefix. *) | |
Fixpoint fcompare (s t : fseq) := | |
match s, t with |
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
(* The Collatz conjecture, to illustrate reckless statements. *) | |
Section Collatz. | |
(* Collatz mapping. *) | |
Definition collatz_map n := if even n then div2 n else n*3+1. | |
(* Collatz sequence starting with n. *) | |
Fixpoint collatz_seq n i := | |
match i with |
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
package main | |
import "container/list" | |
// ListUnion merges the second list into the first list while retaining order. | |
func ListUnion(dst *list.List, src *list.List) { | |
for e1, e2 := src.Front(), dst.Front(); e2 != nil; { | |
if e1 == nil { | |
dst.PushBack(e2.Value) | |
e2.Next() |
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
%%%%%%%%%%%%%%% | |
% Sets and maps | |
%%%%%%%%%%%%%%% | |
% Sets: http://kti.ms.mff.cuni.cz/~bartak/prolog/sets.html | |
% Maps: sets of pairs. | |
list([]). | |
list([_|_]). |
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
#!/usr/bin/env python3 | |
''' | |
Get ./js_facade_gen, and ./three.js | |
Comment out ./three.js/src/renderers/shaders/UniformsUtils.d.ts to avoid errors | |
Navigate to js_facade_gen | |
Under Zsh, run: node index.js --base-path=../three.js --destination=../dart-threejs ../three.js/src/**/*.ts | |
Navigate to ../dart-threejs | |
Add pubspec.yaml with package:js | |
Run this script twice to add the needed Dart SDK imports |
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
import 'dart:html' show UrlSearchParams, EventListener; | |
import 'package:angular/angular.dart' show Provider, Injectable; | |
import 'package:angular_router/src/router/router_impl.dart' show RouterImpl; | |
import 'package:angular_router/angular_router.dart' | |
show Router, Location, LocationStrategy; | |
import 'package:angular_router/angular_router.dart' | |
show PlatformLocation, BrowserPlatformLocation; |
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
/// Proxy iterator for [origin] that caches the result so that it can be | |
/// iterated again using [rewind]. Multiple rewinded copies of this iterator | |
/// share the [sharedCache] so it doesn't matter which one reads from [origin]. | |
class CachedIterator<T> implements Iterator<T> { | |
var _i = -1; | |
var _terminated = false; | |
final Iterator<T> origin; | |
final List<T> sharedCache; | |
CachedIterator(this.origin, [List<T> cache]) |
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
; Turing 1-tape addition calculator | |
; The answer is first written in reverse binary | |
; Example input: 11011000+00011111= | |
; Find equals sign | |
0 * * r 0 | |
0 = = r init-carry | |
; Write initial carry bit | |
init-carry _ 0 l init-carry |
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 program counts the number of a characters in a string | |
; and appends it in reverse binary to the end of the tape | |
; Go to nil state | |
0 * * * nil | |
; Counting program | |
nil a x r odd | |
even a x r odd | |
odd a a r even |
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: | |
s='';for(i=47;i<83;)s+=String.fromCharCode(++i>57?i+7:i) | |
// Is the same as this: | |
s='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' |