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
#include <stdlib.h> | |
#include <stdio.h> | |
#include <math.h> | |
#define BOUND 2000000000 | |
int primes_count = 0; | |
int primes[5000] = {0}; | |
char is_composites[45000] = {0}; // > sqrt(2e9) |
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
#include <stdlib.h> | |
#include <string.h> | |
#include <stdio.h> | |
#define TOKENS "><+-.,[]" | |
#define CODE_SEGMENT_SIZE 30000 | |
#define STACK_SEGMENT_SIZE 1000 | |
#define DATA_SEGMENT_SIZE 30000 | |
#define ERROR_CODE_MISSING_FILE 1 |
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
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <llvm-c/Core.h> | |
#include <llvm-c/Target.h> | |
#include <llvm-c/TargetMachine.h> | |
#define FALSE 0 | |
#define TRUE 1 |
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
; Translate "Hello world of brainfuck" to LLVM IR manually. | |
; ++++++++++ | |
; [>+++++++>++++++++++>+++>+<<<<-] | |
; >++.>+.+++++++..+++.>++.<<+++++++++++++++. | |
; >.+++.------.--------.>+.>. | |
; ModuleID = 'helloworld.bf' | |
source_filename = "helloworld.bf" | |
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" | |
target triple = "x86_64-pc-linux-gnu" |
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
// 球面坐标系统 | |
var Spherical = function(radial, polar, azimuthal) { | |
var self = this; | |
self.radial = radial || 1 | |
self.polar = polar || 0 | |
self.azimuthal = azimuthal || 0 | |
}; | |
// 转换成直角坐标系统 |
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
Y组合子是Lambda演算的一部分,也是函数式编程的理论基础。 | |
它是一种方法/技巧,在没有赋值语句的前提下定义递归的匿名函数。 | |
即仅仅通过Lambda表达式这个最基本的“原子”实现循环/迭代。 | |
颇有道生一、一生二、二生三、三生万物的感觉。 | |
虽然Y组合子在理论上很优美,但在实际开发中并不会真的用到。 | |
想要了解Y组合子是什么,请参见维基百科:http://en.wikipedia.org/wiki/Fixed-point_combinator#Y_combinator | |
或者知乎上的回答:http://www.zhihu.com/question/20115649 |
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
% 知识库 | |
%% 性别的实体 | |
female(ann). | |
female(eve). | |
%% 父母的实体 | |
parent(ann, mary). | |
parent(tom, eve). | |
parent(tom, mary). |
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
#!/usr/bin/env fish | |
function perror --description '显示信息到错误输出' | |
if test (count $argv) -gt 0 | |
printf -- $argv >&2 | |
end | |
echo >&2 | |
end | |
function raise --description '抛出异常消息并退出' |
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
/* | |
* Ctrl(C): ^ | |
* Option(M): ~ | |
*/ | |
{ | |
"^/" = "undo:"; | |
"^a" = "moveToBeginningOfLine:"; | |
"^e" = "moveToEndOfLine:"; | |
"^g" = "_cancelKey:"; | |
"^t" = "transpose:"; |
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
ZSH在交互方面的确比Bash略胜一筹,但习惯了Bash下大小写无关补全等功能,需要对zsh的默认配置做一些调整。 |
NewerOlder