This file contains 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 MString { | |
private static encoder = new TextEncoder() | |
private static decoder = new TextDecoder() | |
private static DEFAULT_BUFFER = new ArrayBuffer(0) | |
private static DEFAULT_VIEW = new DataView(MString.DEFAULT_BUFFER) | |
private static DEFAULT_BORDER_INDEXES = new Array<number>() | |
/** | |
* Memory buffer where raw string byte data are stored | |
*/ | |
private buffer: ArrayBuffer = MString.DEFAULT_BUFFER |
copy from my old repo.
run the script in node.js
added Rust version.
People like to use chain methods like .map
, but these are sometimes not efficient.
I just made a program that iterates using lazy approach.
- The result array is evaluated only at the end of chains (with
.collect
method) - The difference is that the native method creates every single result arrays for each chain process.
- There is no full compatibility with the native methods.
After I took benchmark, I noticed that:
This file contains 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
from time import sleep | |
bar = [[], [], []] | |
numOfDisks = 1 | |
barName = ['left', 'middle', 'right'] | |
def move(bfrom, to, disk): | |
moveTo = 0 | |
while True: | |
if moveTo != bfrom and moveTo != to: | |
break | |
else: |
とんでもなく くだらないことを思いついたのでメモを残しておくぅ!
(アドレス出力のサイズをできるだけ小さくするためにコードの見た目が醜いと思うけど、許してちょ)
const genURL = (msg) => 'data:text/html;charset=utf-8,'+encodeURIComponent(`
<html><head><title>謎の文通</title></head><body><script>
const genURL = ${genURL.toString()}
alert('${msg}')