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 InfiniteList: | |
| def __init__(self, init_val=1, next_val=1): | |
| self.real_list = [] | |
| self.init_val = init_val | |
| self.diff = next_val - init_val | |
| def __getitem__(self, index): | |
| if index < 0: | |
| raise IndexError('Out of index range.') |
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
| #include "permut-1.0.h" | |
| #define DEBUG 0 | |
| int permut(int *sequence, int size, int index) | |
| { | |
| int tempIndex, mainIndex; | |
| int *memo, *memoIndex; | |
| #if DEBUG | |
| printf("\n\nindex=%d:", index); |
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
| #include "permut-1.0.h" | |
| #include "fact.h" | |
| void swap(int *sequence, int i, int j) { | |
| int tmp; | |
| tmp = sequence[i]; | |
| sequence[i] = sequence[j]; | |
| sequence[j] = tmp; | |
| } |
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 python | |
| # -*- encoding:utf-8 -*- | |
| def range(**ranged): | |
| def arged(f): | |
| def ret(*argv, **d): | |
| minv = ranged['min'] | |
| maxv = ranged['max'] | |
| print('*** range check. min: {0}, max: {1} ***'.format(minv, maxv)) | |
| for a in argv: |
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
| package annotations; | |
| import java.lang.reflect.InvocationTargetException; | |
| @TestAnnotation(hoge="fuga") | |
| public class Annotated { | |
| /** |
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
| /* Objects/object.c in Python2.7 */ | |
| PyObject * | |
| _PyObject_New(PyTypeObject *tp) | |
| { | |
| PyObject *op; | |
| op = (PyObject *) PyObject_MALLOC(_PyObject_SIZE(tp)); | |
| if (op == NULL) | |
| return PyErr_NoMemory(); | |
| return PyObject_INIT(op, tp); |
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 SecretFirst(object): | |
| def __secret(self): | |
| print('__secret') | |
| def _SecretFirst__secret(self): | |
| print('_SecretFirst__secret') | |
| class SecretSecond(object): | |
| def _SecretSecond__secret(self): |
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
| public class A { | |
| public static void main(String[] args) { | |
| A a = new A() {}; | |
| System.out.println(a.getClass()); | |
| } | |
| } |
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
| >>> diff(['aaa bbb', 'ccc ddd'], | |
| ... ['aaa xxx', 'bbb ccc ddd']) | |
| (((1, "aaa"), (1, "aaa"), NO_DIFF), | |
| ((1, ""), (1, "xxx"), ADD), | |
| ((1, "bbb"), (2, "bbb"), MOVE), | |
| ((2, "ccc"), (2, "ccc"), MOVE), | |
| ((2, "ddd"), (2, "ddd"), MOVE)) |
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
| enum DataType { | |
| // primitive | |
| BOOLEAN(true), | |
| CHARACTER(true), | |
| INTEGER(true), | |
| DECIMAL(true), | |
| STRING(true), | |
| // non-primitive | |
| TYPE_HASH(false), |
OlderNewer