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 BasicRole { | |
| constructor(name) { | |
| if (this.constructor === BasicRole) { | |
| throw new Error("BasicRoleは抽象クラスのため、インスタンス化できません。"); | |
| } | |
| this.name = name; | |
| } | |
| attack() { | |
| console.log(`${this.name}は攻撃した`); |
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> | |
| <head> | |
| <script> | |
| let isInlineExecuted = false; | |
| /* | |
| let unlock = null; | |
| let forceOpen = null; | |
| const gate = new Promise((resolve, reject) => { | |
| unlock = resolve; | |
| forceOpen = reject; |
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
| console.log("main logic - start"); | |
| (async () => { | |
| try{ | |
| if (isInlineExecuted) { | |
| console.log("main logic - standby"); | |
| await gate; | |
| } | |
| } | |
| catch(e){ |
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> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <script src="fibonacci.js"></script> | |
| <script> | |
| function measurePerformance(label, func){ | |
| const point_start = `${label} ----- start`; | |
| const point_finish = `${label} ----- end`; | |
| performance.mark(point_start); |
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> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <script src="fibonacci.js"></script> | |
| <script> | |
| function measurePerformance(label, func){ | |
| const point_start = `${label} ----- start`; | |
| const point_finish = `${label} ----- 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
| /*function memoization(func){ | |
| let memo = new Map(); | |
| console.log(`counter: ${memo.size}`); | |
| function memoize(arg){ | |
| console.log(`${arg} is received`); | |
| let isExist = memo.get(arg); | |
| if (isExist) { | |
| return isExist; |
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
| module memoization | |
| open System.Collections.Generic | |
| open System.Collections.Concurrent | |
| let memoization fn = | |
| let cache = new Dictionary<_,_>() | |
| printfn "counter: %A" cache.Count | |
| fun arg -> |
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
| #load "fibonacci.fsx" | |
| open fibonacci | |
| open System.Diagnostics | |
| let loop_start = 0 | |
| let loop_end = 40 | |
| let testloop fn = | |
| let sw = new Stopwatch() |
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
| module fibonacci | |
| open System.Collections.Generic | |
| let rec fib n = | |
| match n with | |
| | 0 | 1 -> n | |
| | n -> fib (n-1) + fib (n-2) | |
| [<TailCall>] |
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 A() = class end | |
| type B() = inherit A() | |
| type C() = inherit A() | |
| let evaluation (obj: A) = | |
| match obj with | |
| | :? B -> "It's a B" | |
| | :? C -> "It's a C" | |
| | :? A -> "It's a A" | |
| | _ -> "nothing" |
NewerOlder