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 Base {} | |
| class Derived extends Base {} | |
| class _Main { | |
| function method2(obj : Base) : void { | |
| if (obj instanceof Derived) { | |
| var obj = obj as Derived; | |
| funcA(obj); | |
| } | |
| else { |
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
| ;;; List Monad | |
| (defmethod bind ((m list) f) | |
| (apply #'append (mapcar f m))) | |
| (defmethod fmap ((m list) f) | |
| (mapcar f m)) |
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
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ;;; Utilities | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| (defun singlep (list) | |
| (= (length list) 1)) | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ;;; Core Primitives |
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
| (defparameter list nil) | |
| (defparameter set nil) | |
| (defun visit (node) | |
| (unless (visitedp node) | |
| (mark-visited node) | |
| (loop for m in (connected-nodes node) do | |
| (visit m)) | |
| (push node))) |
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
| /* | |
| * 1. Open facebook.com/pokes | |
| * 2. Open developer console | |
| * 3. input this function | |
| * 4. Run 'poke()' | |
| */ | |
| function poke() { | |
| var a = pagelet_pokes.lastChild.lastChild.firstChild.firstChild.lastChild.lastChild.firstChild.lastChild.lastChild.lastChild; | |
| var e = document.createEvent("MouseEvents"); |
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 Klass.<T> { | |
| var a : T; | |
| } | |
| class _Main { | |
| static function main(args : string[]) : void { | |
| var klass = new Klass.<function(:number):number>; | |
| } | |
| } |
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 A {} | |
| class B extends A {} | |
| class C extends A {} | |
| interface I {} | |
| class X implements I {} | |
| class Y implements I {} | |
| class Z extends Y {} | |
| class _Main { |
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<cstdio> | |
| #include<vector> | |
| #include<algorithm> | |
| using namespace std; | |
| const int SIZE = 100001; | |
| class mint; | |
| mint multiply(mint &lhs, mint &rhs, int n); | |
| class mint { | |
| public: |
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
| (let* ((p1 b) | |
| (v1 (v- a b)) | |
| (p2 d) | |
| (v2 (v- c d))) | |
| (with-vector (x1 y1 z1) v1 | |
| (with-vector (x2 y2 z2) v2 | |
| (with-vector (x3 y3 z3) (v- p1 p2) | |
| (when (<= (abs (- (+ (* x1 y2 z3) (* x2 y3 z1) (* x3 y1 z2)) | |
| (+ (* x3 y2 z1) (* y3 z2 x1) (* z3 x2 y1)))) | |
| *vector3-acceptable-error-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
| STL> (DECOMPOSE-INTERFERENCE dat) | |
| seconds | gc | consed | calls | sec/call | name | |
| --------------------------------------------------------------- | |
| 5.775 | 0.327 | 1,214,028,864 | 660,262 | 0.000009 | CREATE-VECTOR3 | |
| 0.218 | 0.000 | 3,373,952 | 63,762 | 0.000003 | MAKE-SEGMENT | |
| 0.011 | 0.000 | 1,080,752 | 21,254 | 0.000001 | GET-SEGMENTS | |
| 0.008 | 0.000 | 622,304 | 1,246 | 0.000006 | GET-NEIGHBOR-POINTS | |
| 0.005 | 0.000 | 65,536 | 1,246 | 0.000004 | GET-NEAREST-POINT | |
| 0.002 | 0.000 | 65,520 | 1,173 | 0.000002 | MIN/KEY | |
| 0.002 | 0.000 | 0 | 76 | 0.000025 | REGISTER-POINT |