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
| :- tpp( | |
| type Colour = 'MkColour'!(int,int,int); | |
| type Point = 'MkPoint'!(float,float); | |
| type CPoint = 'MkCPoint'!(float,float,Colour); | |
| val 'MkColour' : (int->int->int->Colour); | |
| val c1 : (Colour->int); | |
| val c2 : (Colour->int); | |
| val c3 : (Colour->int); | |
| val 'MkPoint' : (float->float->Point); | |
| val pt1 : (Point->float); |
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
| $ swipl test.pl | |
| 7 |
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
| test: test1 test2 | |
| test1: | |
| swipl funtest.pl | |
| test2: | |
| swipl funtest.pl fun2 |
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
| % An algorithm for type-checking dependent types | |
| :- op(650,xfy,$). | |
| :- op(900,xfy,[=>,->,⇓]). | |
| :- op(920,xfx,[⊢]). | |
| failwith(A,L) :- format(A,L),halt. | |
| % Syntax | |
| id(Id) :- atom(Id). % Identify |
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
| /* | |
| Algorithm W | |
| */ | |
| object poly extends App { | |
| type X = String | |
| type U = Int | |
| type Assump = Map[X, Scheme] | |
| type Subst = Map[U, T] | |
| type FTV = Set[U] |
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
| type x = string | |
| type e = | |
| | EInt of int | |
| | EBool of bool | |
| | EVar of x | |
| | EApp of e * e | |
| | EAbs of x * e | |
| | ELet of x * e * e | |
| let rec show_e = function |
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
| /* | |
| Algorithm W | |
| */ | |
| use std::collections::BTreeMap; | |
| use std::collections::BTreeSet; | |
| type X = String; | |
| type U = i32; | |
| type Assump = BTreeMap<X, Scheme>; | |
| type Subst = BTreeMap<U, T>; |
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
| class MatchError | |
| attr_accessor :r | |
| def initialize(a) | |
| @r = self | |
| @match = a | |
| end | |
| def >>(a) | |
| self | |
| end | |
| def >=(a) |
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
| <html> | |
| <title>SmartLogJs Example</title> | |
| <script src="smartlog.js"></script> | |
| <script> | |
| window.onload = function () { | |
| var counter = 0 | |
| var log = new SmartLog({ | |
| el:document.getElementById("log"), | |
| buildRow:function(){return { | |
| head:"",text:"", |
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
| :- op(1200, xfx, ['--', where, ::=]). | |
| :- op(920, xfx, ['==>', '==>>']). | |
| term_expansion((A where B), (A :- B)). | |
| % 構文 | |
| zip([], [], []). | |
| zip([L|Ls], [R|Rs], [(L,R)|Ps]) :- zip(Ls, Rs, Ps). |