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
| // ES8 非同步產生器 | |
| async function* range(start, end) { | |
| for(let i = start; i < end; i++) { | |
| yield i; | |
| } | |
| } | |
| // 與上頭類似的效果 | |
| function* range2(start, end) { | |
| function* range_inner() { |
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
| // 透過非同步產生器函式 | |
| const vertex2 = { | |
| x: 1, | |
| y: 2, | |
| z: 3, | |
| [Symbol.asyncIterator]: async function* () { | |
| for (let key in this) { | |
| yield this[key]; | |
| } | |
| } |
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 _instanceof(left, right) { | |
| if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { | |
| return !!right[Symbol.hasInstance](left); | |
| } else { | |
| return left instanceof right; | |
| } | |
| } |
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 <iostream> | |
| #include <functional> | |
| using namespace std; | |
| function<int(int)> foo() { | |
| return [](int n) -> int { | |
| function<int(int)> fac = [&](int n) -> int { | |
| return n == 0 ? 1 : n * fac(n-1); | |
| }; | |
| return fac(n); |
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 'package:flutter/material.dart'; | |
| void main() => runApp( | |
| RedSquare( | |
| center: Offset(210, 300), | |
| width: 100, | |
| height: 200, | |
| ) | |
| ); |
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 'package:flutter/material.dart'; | |
| void main() { | |
| runApp( | |
| RedSquare( | |
| center: Offset(210, 300), | |
| width: 100, | |
| height: 200, | |
| ) | |
| ); |
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
| t = 't=\'\\n\nprint(t[0:3]+t[0:2]+t[3]+t[2]+t[3]*2+t[4]+t[3:5]+t[6:]+t[2]+t[5]+t[6:])' | |
| print(t[0:3]+t[0:2]+t[3]+t[2]+t[3]*2+t[4]+t[3:5]+t[6:]+t[2]+t[5]+t[6:]) | |
| # r='r=%r;print(r%%r)';print(r%r) |
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 array(lt) { | |
| let unit = _ => _; | |
| let no_use = unit; | |
| let no = _ => f => f(no_use); | |
| let when = unit; | |
| let left = p => p(l => _ => l); | |
| let right = p => p(_ => r => r); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 numpy as np | |
| import matplotlib.pyplot as plt | |
| freq = 10 # 頻率 | |
| stop = .25 # 取樣範圍為 0 ~ stop | |
| sample_rate = 800 # 取樣率,單位 x 取樣幾次 | |
| x = np.linspace(0, stop, int(stop * sample_rate), endpoint = False) | |
| y = np.sin(freq * 2 * np.pi * x) |