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
| delta(q0, a, q1). | |
| delta(q1, a, q1). | |
| delta(q1, a, q2). | |
| delta(q1, b, q1). | |
| delta(q2, b, q3). | |
| ndfa(L) :- ndfa(q0, L, q3). | |
| ndfa(Q, [], Q). | |
| ndfa(Q0, [A|L], Q) :- |
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
| first([X|_], X). | |
| second([_,X|_], X). | |
| nth(1, [X|_], X). | |
| nth(N, [_|L], X) :- | |
| N > 1, N1 is N-1, nth(N1, L, X). | |
| len([], 0). | |
| len([_|L], N) :- | |
| len(L, N1), N is N1+1. |
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
| fact(0, 1). | |
| fact(N, F) :- | |
| N > 0, | |
| N1 is N-1, | |
| fact(N1, F1), | |
| F is N*F1. | |
| fib(0, 0). | |
| fib(1, 1). | |
| fib(N, F) :- |
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
| arc(a1, v1, v2). | |
| arc(a2, v2, v3). | |
| arc(a3, v3, v4). | |
| arc(a4, v4, v1). | |
| arc(a5, v3, v5). | |
| walk(U, U). | |
| walk(U, V) :- arc(_, U, U1), walk(U1, V). | |
| path(U, 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
| write_siki(X) :- | |
| atomic(X), write(X). | |
| write_siki(X+Y) :- | |
| write_siki(X), write(' と '), | |
| write_siki(Y), write(' との和'). | |
| write_siki(X*Y) :- | |
| write_siki(X), write(' と '), | |
| write_siki(Y), write(' との積'). | |
| d(x, 1). |
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
| father(naoyuki, hyogo). | |
| father(saburo, naoyuki). | |
| father(saburo, shinji). | |
| father(yoshihisa, hisako). | |
| mother(hisako, hyogo). | |
| mother(yoko, naoyuki). | |
| mother(yoko, shinji). | |
| mother(nobuko, hisako). | |
| parent(P, C) :- father(P, C). |
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 Test { | |
| public static void main(String[] args) { | |
| Object[] array = new String[10]; | |
| Object o = array[0]; // OK | |
| array[1] = new Integer(9); // Throw an ArrayStoreException. | |
| } | |
| } |
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 test | |
| .super java/lang/Object | |
| .method public static main([LString;)V | |
| .limit stack 10 | |
| .limit locals 2 | |
| iconst_5 | |
| istore_1 | |
| loop: | |
| iinc 1 -1 |
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
| #import <Foundation/Foundation.h> | |
| @interface ClassA : NSObject | |
| @end | |
| @implementation ClassA | |
| @end | |
| @interface ClassB : NSObject | |
| @end |
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
| #import <Foundation/Foundation.h> | |
| @class A; | |
| @protocol P | |
| - (A*)f; | |
| @end | |
| @interface A : NSObject <P> | |
| - (A*)f; |