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 <stdio.h> | |
| #include <stdlib.h> | |
| typedef struct _Base { | |
| int foo; | |
| } Base; | |
| void base_print_foo(const Base* base) { | |
| printf("foo -> %d\n", base->foo); | |
| } |
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
| ;; 出力結果は 3 の後ろに小数点を付けて最後の 4 桁は未収束の為除いたものが正しい値 | |
| ;; 2019/11/20: 27 で追加された benchmark-progn を使うように変更 | |
| (defun bignum-arccot (x) | |
| (let ((base (expt 10 (+ 10000 4))) | |
| (a x) | |
| (b 1) | |
| pos | |
| (sum 0)) | |
| (while (< 1 (setq pos (truncate base (* a b)))) |
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 <float.h> | |
| #include <math.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| int snprint_double(char* buf, int size, double f) | |
| { | |
| if (isnan(f)) { | |
| return snprintf(buf, size, "%s", signbit(f) ? "-nan" : "+nan"); | |
| } else if (isinf(f)) { |
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> | |
| template<typename First, typename... Rest> | |
| struct Tuple: public Tuple<Rest...> { | |
| Tuple(First first, Rest... rest): Tuple<Rest...>(rest...), first(first) {} | |
| First first; | |
| }; | |
| template<typename First> |
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
| chuntaro@NTEmacs64 windows-nt ~ | |
| $ g++ -O3 -Wall -Wextra test.cpp | |
| chuntaro@NTEmacs64 windows-nt ~ | |
| $ ./a.exe | |
| 500000000 | |
| 810ms | |
| 1000000000 | |
| 1746ms |
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 | |
| (export "memory" (memory 0)) | |
| (export "_start" (func $_start)) | |
| (import "wasi_unstable" "fd_write" | |
| (func $__wasi_fd_write (param i32) (param i32) (param i32) (param i32) (result i32))) | |
| (memory 2) | |
| (data (i32.const 1024) "Hello, World!\n") | |
| (func $_start | |
| i32.const 0 | |
| i32.const 1024 |
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
| (defmacro xyzzy-dolist ((var listform &optional (resultform ''nil)) &body body) | |
| `(do* ((#1=#:tailvar ,listform (cdr #1#)) | |
| (,var (car #1#) (car #1#))) | |
| ((null #1#) ,resultform) | |
| ,@body)) |
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 (cs) | |
| (dolist (x '(1 2 3 4 5)) | |
| (push #'(lambda () x) cs)) | |
| (mapcar #'funcall cs)) | |
| ;;=> (5 4 3 2 1) | |
| ;; 展開後 (こんな感じになる) | |
| (let ((ls '(1 2 3 4 5)) | |
| cs) | |
| (while ls |
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 array = [...Array(50)].map(_ => Math.floor(Math.random() * 20)); | |
| let a = array.filter(function (x, i, self) { | |
| return self.indexOf(x) === i; | |
| }); | |
| let b = Array.from(new Set(array)); | |
| console.log(a, b); | |
| let loopCount = 1000000; |
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
| ;; `vc-git-grep'はインタラクティブに実行するとファイル名等色々聞いてくるので | |
| ;; Enterだけで実行する為のラッパーコマンド | |
| (defun vc-git-grep-quick (regexp &optional files dir) | |
| (interactive | |
| (progn | |
| (grep-compute-defaults) | |
| (let ((regexp (grep-read-regexp)) | |
| (files (concat "*." (file-name-extension (buffer-file-name)))) | |
| (dir ".")) |