mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-12-08 12:28:47 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -84,7 +84,7 @@ To run the tests:
|
|||||||
|
|
||||||
The majority of patches won't need to touch any Ruby code at all. The [master language list](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml) is just a configuration file.
|
The majority of patches won't need to touch any Ruby code at all. The [master language list](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml) is just a configuration file.
|
||||||
|
|
||||||
We try to only add languages once they have a some usage on GitHub, so please note in-the-wild usage examples in your pull request.
|
We try to only add languages once they have some usage on GitHub, so please note in-the-wild usage examples in your pull request.
|
||||||
|
|
||||||
Almost all bug fixes or new language additions should come with some additional code samples. Just drop them under [`samples/`](https://github.com/github/linguist/tree/master/samples) in the correct subdirectory and our test suite will automatically test them. In most cases you shouldn't need to add any new assertions.
|
Almost all bug fixes or new language additions should come with some additional code samples. Just drop them under [`samples/`](https://github.com/github/linguist/tree/master/samples) in the correct subdirectory and our test suite will automatically test them. In most cases you shouldn't need to add any new assertions.
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
Gem::Specification.new do |s|
|
Gem::Specification.new do |s|
|
||||||
s.name = 'github-linguist'
|
s.name = 'github-linguist'
|
||||||
s.version = '2.9.4'
|
s.version = '2.9.5'
|
||||||
s.summary = "GitHub Language detection"
|
s.summary = "GitHub Language detection"
|
||||||
|
|
||||||
s.authors = "GitHub"
|
s.authors = "GitHub"
|
||||||
|
|||||||
@@ -452,7 +452,6 @@ module Linguist
|
|||||||
extnames.each do |extname|
|
extnames.each do |extname|
|
||||||
if !options['extensions'].include?(extname)
|
if !options['extensions'].include?(extname)
|
||||||
options['extensions'] << extname
|
options['extensions'] << extname
|
||||||
else
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -461,7 +460,6 @@ module Linguist
|
|||||||
fns.each do |filename|
|
fns.each do |filename|
|
||||||
if !options['filenames'].include?(filename)
|
if !options['filenames'].include?(filename)
|
||||||
options['filenames'] << filename
|
options['filenames'] << filename
|
||||||
else
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -242,6 +242,7 @@ Clojure:
|
|||||||
primary_extension: .clj
|
primary_extension: .clj
|
||||||
extensions:
|
extensions:
|
||||||
- .cljs
|
- .cljs
|
||||||
|
- .cljx
|
||||||
filenames:
|
filenames:
|
||||||
- riemann.config
|
- riemann.config
|
||||||
|
|
||||||
@@ -282,6 +283,7 @@ Common Lisp:
|
|||||||
- .asd
|
- .asd
|
||||||
- .lsp
|
- .lsp
|
||||||
- .ny
|
- .ny
|
||||||
|
- .podsl
|
||||||
|
|
||||||
Coq:
|
Coq:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -338,14 +340,6 @@ Dart:
|
|||||||
type: programming
|
type: programming
|
||||||
primary_extension: .dart
|
primary_extension: .dart
|
||||||
|
|
||||||
Delphi:
|
|
||||||
type: programming
|
|
||||||
color: "#b0ce4e"
|
|
||||||
primary_extension: .pas
|
|
||||||
extensions:
|
|
||||||
- .dfm
|
|
||||||
- .lpr
|
|
||||||
|
|
||||||
DCPU-16 ASM:
|
DCPU-16 ASM:
|
||||||
type: programming
|
type: programming
|
||||||
lexer: dasm16
|
lexer: dasm16
|
||||||
@@ -635,7 +629,6 @@ Haxe:
|
|||||||
INI:
|
INI:
|
||||||
type: data
|
type: data
|
||||||
extensions:
|
extensions:
|
||||||
- .cfg
|
|
||||||
- .ini
|
- .ini
|
||||||
- .prefs
|
- .prefs
|
||||||
- .properties
|
- .properties
|
||||||
@@ -714,6 +707,13 @@ Kotlin:
|
|||||||
- .ktm
|
- .ktm
|
||||||
- .kts
|
- .kts
|
||||||
|
|
||||||
|
LFE:
|
||||||
|
type: programming
|
||||||
|
primary_extension: .lfe
|
||||||
|
color: "#004200"
|
||||||
|
lexer: Common Lisp
|
||||||
|
group: Erlang
|
||||||
|
|
||||||
LLVM:
|
LLVM:
|
||||||
primary_extension: .ll
|
primary_extension: .ll
|
||||||
|
|
||||||
@@ -1011,6 +1011,15 @@ Parrot Assembly:
|
|||||||
- pasm
|
- pasm
|
||||||
primary_extension: .pasm
|
primary_extension: .pasm
|
||||||
|
|
||||||
|
Pascal:
|
||||||
|
type: programming
|
||||||
|
lexer: Delphi
|
||||||
|
color: "#b0ce4e"
|
||||||
|
primary_extension: .pas
|
||||||
|
extensions:
|
||||||
|
- .dfm
|
||||||
|
- .lpr
|
||||||
|
|
||||||
Perl:
|
Perl:
|
||||||
type: programming
|
type: programming
|
||||||
ace_mode: perl
|
ace_mode: perl
|
||||||
@@ -1101,6 +1110,8 @@ R:
|
|||||||
color: "#198ce7"
|
color: "#198ce7"
|
||||||
lexer: S
|
lexer: S
|
||||||
primary_extension: .r
|
primary_extension: .r
|
||||||
|
filenames:
|
||||||
|
- .Rprofile
|
||||||
|
|
||||||
RHTML:
|
RHTML:
|
||||||
type: markup
|
type: markup
|
||||||
@@ -1258,6 +1269,11 @@ Smalltalk:
|
|||||||
Smarty:
|
Smarty:
|
||||||
primary_extension: .tpl
|
primary_extension: .tpl
|
||||||
|
|
||||||
|
Squirrel:
|
||||||
|
type: programming
|
||||||
|
lexer: C++
|
||||||
|
primary_extension: .nut
|
||||||
|
|
||||||
Standard ML:
|
Standard ML:
|
||||||
type: programming
|
type: programming
|
||||||
color: "#dc566d"
|
color: "#dc566d"
|
||||||
@@ -1334,7 +1350,6 @@ Twig:
|
|||||||
TypeScript:
|
TypeScript:
|
||||||
type: programming
|
type: programming
|
||||||
color: "#31859c"
|
color: "#31859c"
|
||||||
lexer: Text only
|
|
||||||
aliases:
|
aliases:
|
||||||
- ts
|
- ts
|
||||||
primary_extension: .ts
|
primary_extension: .ts
|
||||||
@@ -1439,6 +1454,7 @@ XML:
|
|||||||
- .wxi
|
- .wxi
|
||||||
- .wxl
|
- .wxl
|
||||||
- .wxs
|
- .wxs
|
||||||
|
- .x3d
|
||||||
- .xaml
|
- .xaml
|
||||||
- .xlf
|
- .xlf
|
||||||
- .xliff
|
- .xliff
|
||||||
@@ -1482,7 +1498,7 @@ Xtend:
|
|||||||
primary_extension: .xtend
|
primary_extension: .xtend
|
||||||
|
|
||||||
YAML:
|
YAML:
|
||||||
type: markup
|
type: data
|
||||||
aliases:
|
aliases:
|
||||||
- yml
|
- yml
|
||||||
primary_extension: .yml
|
primary_extension: .yml
|
||||||
|
|||||||
@@ -32,6 +32,12 @@
|
|||||||
"Ceylon": [
|
"Ceylon": [
|
||||||
".ceylon"
|
".ceylon"
|
||||||
],
|
],
|
||||||
|
"COBOL": [
|
||||||
|
".cbl",
|
||||||
|
".ccp",
|
||||||
|
".cob",
|
||||||
|
".cpy"
|
||||||
|
],
|
||||||
"CoffeeScript": [
|
"CoffeeScript": [
|
||||||
".coffee"
|
".coffee"
|
||||||
],
|
],
|
||||||
@@ -44,9 +50,6 @@
|
|||||||
"Dart": [
|
"Dart": [
|
||||||
".dart"
|
".dart"
|
||||||
],
|
],
|
||||||
"Delphi": [
|
|
||||||
".dpr"
|
|
||||||
],
|
|
||||||
"Diff": [
|
"Diff": [
|
||||||
".patch"
|
".patch"
|
||||||
],
|
],
|
||||||
@@ -77,6 +80,10 @@
|
|||||||
"GAS": [
|
"GAS": [
|
||||||
".s"
|
".s"
|
||||||
],
|
],
|
||||||
|
"GLSL": [
|
||||||
|
".fp",
|
||||||
|
".glsl"
|
||||||
|
],
|
||||||
"Gosu": [
|
"Gosu": [
|
||||||
".gs",
|
".gs",
|
||||||
".gsp",
|
".gsp",
|
||||||
@@ -205,6 +212,9 @@
|
|||||||
"Parrot Internal Representation": [
|
"Parrot Internal Representation": [
|
||||||
".pir"
|
".pir"
|
||||||
],
|
],
|
||||||
|
"Pascal": [
|
||||||
|
".dpr"
|
||||||
|
],
|
||||||
"Perl": [
|
"Perl": [
|
||||||
".fcgi",
|
".fcgi",
|
||||||
".pl",
|
".pl",
|
||||||
@@ -318,6 +328,9 @@
|
|||||||
"Visual Basic": [
|
"Visual Basic": [
|
||||||
".cls"
|
".cls"
|
||||||
],
|
],
|
||||||
|
"Volt": [
|
||||||
|
".volt"
|
||||||
|
],
|
||||||
"wisp": [
|
"wisp": [
|
||||||
".wisp"
|
".wisp"
|
||||||
],
|
],
|
||||||
@@ -399,8 +412,8 @@
|
|||||||
".gemrc"
|
".gemrc"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"tokens_total": 407642,
|
"tokens_total": 411886,
|
||||||
"languages_total": 439,
|
"languages_total": 447,
|
||||||
"tokens": {
|
"tokens": {
|
||||||
"ABAP": {
|
"ABAP": {
|
||||||
"*/**": 1,
|
"*/**": 1,
|
||||||
@@ -9844,6 +9857,37 @@
|
|||||||
"<=>": 1,
|
"<=>": 1,
|
||||||
"other.name": 1
|
"other.name": 1
|
||||||
},
|
},
|
||||||
|
"COBOL": {
|
||||||
|
"program": 1,
|
||||||
|
"-": 19,
|
||||||
|
"id.": 1,
|
||||||
|
"hello.": 3,
|
||||||
|
"procedure": 1,
|
||||||
|
"division.": 1,
|
||||||
|
"display": 1,
|
||||||
|
".": 3,
|
||||||
|
"stop": 1,
|
||||||
|
"run.": 1,
|
||||||
|
"IDENTIFICATION": 2,
|
||||||
|
"DIVISION.": 4,
|
||||||
|
"PROGRAM": 2,
|
||||||
|
"ID.": 2,
|
||||||
|
"PROCEDURE": 2,
|
||||||
|
"DISPLAY": 2,
|
||||||
|
"STOP": 2,
|
||||||
|
"RUN.": 2,
|
||||||
|
"COBOL": 7,
|
||||||
|
"TEST": 2,
|
||||||
|
"RECORD.": 1,
|
||||||
|
"USAGES.": 1,
|
||||||
|
"COMP": 5,
|
||||||
|
"PIC": 5,
|
||||||
|
"S9": 4,
|
||||||
|
"(": 5,
|
||||||
|
")": 5,
|
||||||
|
"COMP.": 3,
|
||||||
|
"COMP2": 2
|
||||||
|
},
|
||||||
"CoffeeScript": {
|
"CoffeeScript": {
|
||||||
"CoffeeScript": 1,
|
"CoffeeScript": 1,
|
||||||
"require": 21,
|
"require": 21,
|
||||||
@@ -12675,30 +12719,6 @@
|
|||||||
"q": 1,
|
"q": 1,
|
||||||
"print": 1
|
"print": 1
|
||||||
},
|
},
|
||||||
"Delphi": {
|
|
||||||
"program": 1,
|
|
||||||
"gmail": 1,
|
|
||||||
";": 6,
|
|
||||||
"uses": 1,
|
|
||||||
"Forms": 1,
|
|
||||||
"Unit2": 1,
|
|
||||||
"in": 1,
|
|
||||||
"{": 2,
|
|
||||||
"Form2": 2,
|
|
||||||
"}": 2,
|
|
||||||
"R": 1,
|
|
||||||
"*.res": 1,
|
|
||||||
"begin": 1,
|
|
||||||
"Application.Initialize": 1,
|
|
||||||
"Application.MainFormOnTaskbar": 1,
|
|
||||||
"True": 1,
|
|
||||||
"Application.CreateForm": 1,
|
|
||||||
"(": 1,
|
|
||||||
"TForm2": 1,
|
|
||||||
")": 1,
|
|
||||||
"Application.Run": 1,
|
|
||||||
"end.": 1
|
|
||||||
},
|
|
||||||
"Diff": {
|
"Diff": {
|
||||||
"diff": 1,
|
"diff": 1,
|
||||||
"-": 5,
|
"-": 5,
|
||||||
@@ -14147,6 +14167,491 @@
|
|||||||
"xd": 1,
|
"xd": 1,
|
||||||
".subsections_via_symbols": 1
|
".subsections_via_symbols": 1
|
||||||
},
|
},
|
||||||
|
"GLSL": {
|
||||||
|
"////": 4,
|
||||||
|
"High": 1,
|
||||||
|
"quality": 2,
|
||||||
|
"(": 386,
|
||||||
|
"Some": 1,
|
||||||
|
"browsers": 1,
|
||||||
|
"may": 1,
|
||||||
|
"freeze": 1,
|
||||||
|
"or": 1,
|
||||||
|
"crash": 1,
|
||||||
|
")": 386,
|
||||||
|
"//#define": 10,
|
||||||
|
"HIGHQUALITY": 2,
|
||||||
|
"Medium": 1,
|
||||||
|
"Should": 1,
|
||||||
|
"be": 1,
|
||||||
|
"fine": 1,
|
||||||
|
"on": 3,
|
||||||
|
"all": 1,
|
||||||
|
"systems": 1,
|
||||||
|
"works": 1,
|
||||||
|
"Intel": 1,
|
||||||
|
"HD2000": 1,
|
||||||
|
"Win7": 1,
|
||||||
|
"but": 1,
|
||||||
|
"quite": 1,
|
||||||
|
"slow": 1,
|
||||||
|
"MEDIUMQUALITY": 2,
|
||||||
|
"Defaults": 1,
|
||||||
|
"REFLECTIONS": 3,
|
||||||
|
"#define": 13,
|
||||||
|
"SHADOWS": 5,
|
||||||
|
"GRASS": 3,
|
||||||
|
"SMALL_WAVES": 4,
|
||||||
|
"RAGGED_LEAVES": 5,
|
||||||
|
"DETAILED_NOISE": 3,
|
||||||
|
"LIGHT_AA": 3,
|
||||||
|
"//": 36,
|
||||||
|
"sample": 2,
|
||||||
|
"SSAA": 2,
|
||||||
|
"HEAVY_AA": 2,
|
||||||
|
"x2": 5,
|
||||||
|
"RG": 1,
|
||||||
|
"TONEMAP": 5,
|
||||||
|
"Configurations": 1,
|
||||||
|
"#ifdef": 14,
|
||||||
|
"#endif": 14,
|
||||||
|
"const": 18,
|
||||||
|
"float": 103,
|
||||||
|
"eps": 5,
|
||||||
|
"e": 4,
|
||||||
|
"-": 108,
|
||||||
|
";": 353,
|
||||||
|
"PI": 3,
|
||||||
|
"vec3": 165,
|
||||||
|
"sunDir": 5,
|
||||||
|
"skyCol": 4,
|
||||||
|
"sandCol": 2,
|
||||||
|
"treeCol": 2,
|
||||||
|
"grassCol": 2,
|
||||||
|
"leavesCol": 4,
|
||||||
|
"leavesPos": 4,
|
||||||
|
"sunCol": 5,
|
||||||
|
"#else": 5,
|
||||||
|
"exposure": 1,
|
||||||
|
"Only": 1,
|
||||||
|
"used": 1,
|
||||||
|
"when": 1,
|
||||||
|
"tonemapping": 1,
|
||||||
|
"mod289": 4,
|
||||||
|
"x": 11,
|
||||||
|
"{": 61,
|
||||||
|
"return": 47,
|
||||||
|
"floor": 8,
|
||||||
|
"*": 115,
|
||||||
|
"/": 24,
|
||||||
|
"}": 61,
|
||||||
|
"vec4": 72,
|
||||||
|
"permute": 4,
|
||||||
|
"x*34.0": 1,
|
||||||
|
"+": 108,
|
||||||
|
"*x": 3,
|
||||||
|
"taylorInvSqrt": 2,
|
||||||
|
"r": 14,
|
||||||
|
"snoise": 7,
|
||||||
|
"v": 8,
|
||||||
|
"vec2": 26,
|
||||||
|
"C": 1,
|
||||||
|
"/6.0": 1,
|
||||||
|
"/3.0": 1,
|
||||||
|
"D": 1,
|
||||||
|
"i": 38,
|
||||||
|
"dot": 30,
|
||||||
|
"C.yyy": 2,
|
||||||
|
"x0": 7,
|
||||||
|
"C.xxx": 2,
|
||||||
|
"g": 2,
|
||||||
|
"step": 2,
|
||||||
|
"x0.yzx": 1,
|
||||||
|
"x0.xyz": 1,
|
||||||
|
"l": 1,
|
||||||
|
"i1": 2,
|
||||||
|
"min": 11,
|
||||||
|
"g.xyz": 2,
|
||||||
|
"l.zxy": 2,
|
||||||
|
"i2": 2,
|
||||||
|
"max": 9,
|
||||||
|
"x1": 4,
|
||||||
|
"*C.x": 2,
|
||||||
|
"/3": 1,
|
||||||
|
"C.y": 1,
|
||||||
|
"x3": 4,
|
||||||
|
"D.yyy": 1,
|
||||||
|
"D.y": 1,
|
||||||
|
"p": 26,
|
||||||
|
"i.z": 1,
|
||||||
|
"i1.z": 1,
|
||||||
|
"i2.z": 1,
|
||||||
|
"i.y": 1,
|
||||||
|
"i1.y": 1,
|
||||||
|
"i2.y": 1,
|
||||||
|
"i.x": 1,
|
||||||
|
"i1.x": 1,
|
||||||
|
"i2.x": 1,
|
||||||
|
"n_": 2,
|
||||||
|
"/7.0": 1,
|
||||||
|
"ns": 4,
|
||||||
|
"D.wyz": 1,
|
||||||
|
"D.xzx": 1,
|
||||||
|
"j": 4,
|
||||||
|
"ns.z": 3,
|
||||||
|
"mod": 2,
|
||||||
|
"*7": 1,
|
||||||
|
"x_": 3,
|
||||||
|
"y_": 2,
|
||||||
|
"N": 1,
|
||||||
|
"*ns.x": 2,
|
||||||
|
"ns.yyyy": 2,
|
||||||
|
"y": 2,
|
||||||
|
"h": 21,
|
||||||
|
"abs": 2,
|
||||||
|
"b0": 3,
|
||||||
|
"x.xy": 1,
|
||||||
|
"y.xy": 1,
|
||||||
|
"b1": 3,
|
||||||
|
"x.zw": 1,
|
||||||
|
"y.zw": 1,
|
||||||
|
"//vec4": 3,
|
||||||
|
"s0": 2,
|
||||||
|
"lessThan": 2,
|
||||||
|
"*2.0": 4,
|
||||||
|
"s1": 2,
|
||||||
|
"sh": 1,
|
||||||
|
"a0": 1,
|
||||||
|
"b0.xzyw": 1,
|
||||||
|
"s0.xzyw*sh.xxyy": 1,
|
||||||
|
"a1": 1,
|
||||||
|
"b1.xzyw": 1,
|
||||||
|
"s1.xzyw*sh.zzww": 1,
|
||||||
|
"p0": 5,
|
||||||
|
"a0.xy": 1,
|
||||||
|
"h.x": 1,
|
||||||
|
"p1": 5,
|
||||||
|
"a0.zw": 1,
|
||||||
|
"h.y": 1,
|
||||||
|
"p2": 5,
|
||||||
|
"a1.xy": 1,
|
||||||
|
"h.z": 1,
|
||||||
|
"p3": 5,
|
||||||
|
"a1.zw": 1,
|
||||||
|
"h.w": 1,
|
||||||
|
"//Normalise": 1,
|
||||||
|
"gradients": 1,
|
||||||
|
"norm": 1,
|
||||||
|
"norm.x": 1,
|
||||||
|
"norm.y": 1,
|
||||||
|
"norm.z": 1,
|
||||||
|
"norm.w": 1,
|
||||||
|
"m": 8,
|
||||||
|
"m*m": 1,
|
||||||
|
"fbm": 2,
|
||||||
|
"final": 5,
|
||||||
|
"waterHeight": 4,
|
||||||
|
"d": 10,
|
||||||
|
"length": 7,
|
||||||
|
"p.xz": 2,
|
||||||
|
"sin": 8,
|
||||||
|
"iGlobalTime": 7,
|
||||||
|
"Island": 1,
|
||||||
|
"waves": 3,
|
||||||
|
"p*0.5": 1,
|
||||||
|
"Other": 1,
|
||||||
|
"bump": 2,
|
||||||
|
"pos": 42,
|
||||||
|
"rayDir": 43,
|
||||||
|
"s": 23,
|
||||||
|
"Fade": 1,
|
||||||
|
"out": 1,
|
||||||
|
"to": 1,
|
||||||
|
"reduce": 1,
|
||||||
|
"aliasing": 1,
|
||||||
|
"dist": 7,
|
||||||
|
"<": 23,
|
||||||
|
"sqrt": 6,
|
||||||
|
"Calculate": 1,
|
||||||
|
"normal": 7,
|
||||||
|
"from": 2,
|
||||||
|
"heightmap": 1,
|
||||||
|
"pos.x": 1,
|
||||||
|
"iGlobalTime*0.5": 1,
|
||||||
|
"pos.z": 2,
|
||||||
|
"*0.7": 1,
|
||||||
|
"*s": 4,
|
||||||
|
"normalize": 14,
|
||||||
|
"e.xyy": 1,
|
||||||
|
"e.yxy": 1,
|
||||||
|
"intersectSphere": 2,
|
||||||
|
"rpos": 5,
|
||||||
|
"rdir": 3,
|
||||||
|
"rad": 2,
|
||||||
|
"op": 5,
|
||||||
|
"b": 5,
|
||||||
|
"det": 11,
|
||||||
|
"b*b": 2,
|
||||||
|
"rad*rad": 2,
|
||||||
|
"if": 29,
|
||||||
|
"t": 44,
|
||||||
|
"rdir*t": 1,
|
||||||
|
"intersectCylinder": 1,
|
||||||
|
"rdir2": 2,
|
||||||
|
"rdir.yz": 1,
|
||||||
|
"op.yz": 3,
|
||||||
|
"rpos.yz": 2,
|
||||||
|
"rdir2*t": 2,
|
||||||
|
"pos.yz": 2,
|
||||||
|
"intersectPlane": 3,
|
||||||
|
"rayPos": 38,
|
||||||
|
"n": 18,
|
||||||
|
"sign": 1,
|
||||||
|
"rotate": 5,
|
||||||
|
"theta": 6,
|
||||||
|
"c": 6,
|
||||||
|
"cos": 4,
|
||||||
|
"p.x": 2,
|
||||||
|
"p.z": 2,
|
||||||
|
"p.y": 1,
|
||||||
|
"impulse": 2,
|
||||||
|
"k": 8,
|
||||||
|
"by": 1,
|
||||||
|
"iq": 2,
|
||||||
|
"k*x": 1,
|
||||||
|
"exp": 2,
|
||||||
|
"grass": 2,
|
||||||
|
"Optimization": 1,
|
||||||
|
"Avoid": 1,
|
||||||
|
"noise": 1,
|
||||||
|
"too": 1,
|
||||||
|
"far": 1,
|
||||||
|
"away": 1,
|
||||||
|
"pos.y": 8,
|
||||||
|
"tree": 2,
|
||||||
|
"pos.y*0.03": 2,
|
||||||
|
"mat2": 2,
|
||||||
|
"m*pos.xy": 1,
|
||||||
|
"width": 2,
|
||||||
|
"clamp": 4,
|
||||||
|
"scene": 7,
|
||||||
|
"vtree": 4,
|
||||||
|
"vgrass": 2,
|
||||||
|
".x": 4,
|
||||||
|
"eps.xyy": 1,
|
||||||
|
"eps.yxy": 1,
|
||||||
|
"eps.yyx": 1,
|
||||||
|
"plantsShadow": 2,
|
||||||
|
"Soft": 1,
|
||||||
|
"shadow": 4,
|
||||||
|
"taken": 1,
|
||||||
|
"for": 7,
|
||||||
|
"int": 7,
|
||||||
|
"rayDir*t": 2,
|
||||||
|
"res": 6,
|
||||||
|
"res.x": 3,
|
||||||
|
"k*res.x/t": 1,
|
||||||
|
"s*s*": 1,
|
||||||
|
"intersectWater": 2,
|
||||||
|
"rayPos.y": 1,
|
||||||
|
"rayDir.y": 1,
|
||||||
|
"intersectSand": 3,
|
||||||
|
"intersectTreasure": 2,
|
||||||
|
"intersectLeaf": 2,
|
||||||
|
"openAmount": 4,
|
||||||
|
"dir": 2,
|
||||||
|
"offset": 5,
|
||||||
|
"rayDir*res.w": 1,
|
||||||
|
"pos*0.8": 2,
|
||||||
|
"||": 3,
|
||||||
|
"res.w": 6,
|
||||||
|
"res2": 2,
|
||||||
|
"dir.xy": 1,
|
||||||
|
"dir.z": 1,
|
||||||
|
"rayDir*res2.w": 1,
|
||||||
|
"res2.w": 3,
|
||||||
|
"&&": 10,
|
||||||
|
"leaves": 7,
|
||||||
|
"e20": 3,
|
||||||
|
"sway": 5,
|
||||||
|
"fract": 1,
|
||||||
|
"upDownSway": 2,
|
||||||
|
"angleOffset": 3,
|
||||||
|
"Left": 1,
|
||||||
|
"right": 1,
|
||||||
|
"alpha": 3,
|
||||||
|
"Up": 1,
|
||||||
|
"down": 1,
|
||||||
|
"k*10.0": 1,
|
||||||
|
"p.xzy": 1,
|
||||||
|
".xzy": 2,
|
||||||
|
"d.xzy": 1,
|
||||||
|
"Shift": 1,
|
||||||
|
"Intersect": 11,
|
||||||
|
"individual": 1,
|
||||||
|
"leaf": 1,
|
||||||
|
"res.xyz": 1,
|
||||||
|
"sand": 2,
|
||||||
|
"resSand": 2,
|
||||||
|
"//if": 1,
|
||||||
|
"resSand.w": 4,
|
||||||
|
"plants": 6,
|
||||||
|
"resLeaves": 3,
|
||||||
|
"resLeaves.w": 10,
|
||||||
|
"e7": 3,
|
||||||
|
"light": 5,
|
||||||
|
"sunDir*0.01": 2,
|
||||||
|
"col": 32,
|
||||||
|
"n.y": 3,
|
||||||
|
"lightLeaves": 3,
|
||||||
|
"ao": 5,
|
||||||
|
"sky": 5,
|
||||||
|
"res.y": 2,
|
||||||
|
"uvFact": 2,
|
||||||
|
"uv": 12,
|
||||||
|
"n.x": 1,
|
||||||
|
"tex": 6,
|
||||||
|
"texture2D": 6,
|
||||||
|
"iChannel0": 3,
|
||||||
|
".rgb": 2,
|
||||||
|
"e8": 1,
|
||||||
|
"traceReflection": 2,
|
||||||
|
"resPlants": 2,
|
||||||
|
"resPlants.w": 6,
|
||||||
|
"resPlants.xyz": 2,
|
||||||
|
"pos.xz": 2,
|
||||||
|
"leavesPos.xz": 2,
|
||||||
|
".r": 3,
|
||||||
|
"resLeaves.xyz": 2,
|
||||||
|
"trace": 2,
|
||||||
|
"resSand.xyz": 1,
|
||||||
|
"treasure": 1,
|
||||||
|
"chest": 1,
|
||||||
|
"resTreasure": 1,
|
||||||
|
"resTreasure.w": 4,
|
||||||
|
"resTreasure.xyz": 1,
|
||||||
|
"water": 1,
|
||||||
|
"resWater": 1,
|
||||||
|
"resWater.w": 4,
|
||||||
|
"ct": 2,
|
||||||
|
"fresnel": 2,
|
||||||
|
"pow": 3,
|
||||||
|
"trans": 2,
|
||||||
|
"reflDir": 3,
|
||||||
|
"reflect": 1,
|
||||||
|
"refl": 3,
|
||||||
|
"resWater.t": 1,
|
||||||
|
"mix": 2,
|
||||||
|
"camera": 8,
|
||||||
|
"px": 4,
|
||||||
|
"rd": 1,
|
||||||
|
"iResolution.yy": 1,
|
||||||
|
"iResolution.x/iResolution.y*0.5": 1,
|
||||||
|
"rd.x": 1,
|
||||||
|
"rd.y": 1,
|
||||||
|
"void": 5,
|
||||||
|
"main": 3,
|
||||||
|
"gl_FragCoord.xy": 7,
|
||||||
|
"*0.25": 4,
|
||||||
|
"*0.5": 1,
|
||||||
|
"Optimized": 1,
|
||||||
|
"Haarm": 1,
|
||||||
|
"Peter": 1,
|
||||||
|
"Duiker": 1,
|
||||||
|
"curve": 1,
|
||||||
|
"col*exposure": 1,
|
||||||
|
"x*": 2,
|
||||||
|
".5": 1,
|
||||||
|
"gl_FragColor": 2,
|
||||||
|
"NUM_LIGHTS": 4,
|
||||||
|
"AMBIENT": 2,
|
||||||
|
"MAX_DIST": 3,
|
||||||
|
"MAX_DIST_SQUARED": 3,
|
||||||
|
"uniform": 7,
|
||||||
|
"lightColor": 3,
|
||||||
|
"[": 29,
|
||||||
|
"]": 29,
|
||||||
|
"varying": 3,
|
||||||
|
"fragmentNormal": 2,
|
||||||
|
"cameraVector": 2,
|
||||||
|
"lightVector": 4,
|
||||||
|
"initialize": 1,
|
||||||
|
"diffuse/specular": 1,
|
||||||
|
"lighting": 1,
|
||||||
|
"diffuse": 4,
|
||||||
|
"specular": 4,
|
||||||
|
"the": 1,
|
||||||
|
"fragment": 1,
|
||||||
|
"and": 2,
|
||||||
|
"direction": 1,
|
||||||
|
"cameraDir": 2,
|
||||||
|
"loop": 1,
|
||||||
|
"through": 1,
|
||||||
|
"each": 1,
|
||||||
|
"calculate": 1,
|
||||||
|
"distance": 1,
|
||||||
|
"between": 1,
|
||||||
|
"distFactor": 3,
|
||||||
|
"lightDir": 3,
|
||||||
|
"diffuseDot": 2,
|
||||||
|
"halfAngle": 2,
|
||||||
|
"specularColor": 2,
|
||||||
|
"specularDot": 2,
|
||||||
|
"sample.rgb": 1,
|
||||||
|
"sample.a": 1,
|
||||||
|
"#version": 1,
|
||||||
|
"kCoeff": 2,
|
||||||
|
"kCube": 2,
|
||||||
|
"uShift": 3,
|
||||||
|
"vShift": 3,
|
||||||
|
"chroma_red": 2,
|
||||||
|
"chroma_green": 2,
|
||||||
|
"chroma_blue": 2,
|
||||||
|
"bool": 1,
|
||||||
|
"apply_disto": 4,
|
||||||
|
"sampler2D": 1,
|
||||||
|
"input1": 4,
|
||||||
|
"adsk_input1_w": 4,
|
||||||
|
"adsk_input1_h": 3,
|
||||||
|
"adsk_input1_aspect": 1,
|
||||||
|
"adsk_input1_frameratio": 5,
|
||||||
|
"adsk_result_w": 3,
|
||||||
|
"adsk_result_h": 2,
|
||||||
|
"distortion_f": 3,
|
||||||
|
"f": 17,
|
||||||
|
"r*r": 1,
|
||||||
|
"inverse_f": 2,
|
||||||
|
"lut": 9,
|
||||||
|
"max_r": 2,
|
||||||
|
"incr": 2,
|
||||||
|
"lut_r": 5,
|
||||||
|
".z": 5,
|
||||||
|
".y": 2,
|
||||||
|
"aberrate": 4,
|
||||||
|
"chroma": 2,
|
||||||
|
"chromaticize_and_invert": 2,
|
||||||
|
"rgb_f": 5,
|
||||||
|
"px.x": 2,
|
||||||
|
"px.y": 2,
|
||||||
|
"uv.x": 11,
|
||||||
|
"uv.y": 7,
|
||||||
|
"*2": 2,
|
||||||
|
"uv.x*uv.x": 1,
|
||||||
|
"uv.y*uv.y": 1,
|
||||||
|
"else": 1,
|
||||||
|
"rgb_uvs": 12,
|
||||||
|
"rgb_f.rr": 1,
|
||||||
|
"rgb_f.gg": 1,
|
||||||
|
"rgb_f.bb": 1,
|
||||||
|
"sampled": 1,
|
||||||
|
"sampled.r": 1,
|
||||||
|
"sampled.g": 1,
|
||||||
|
".g": 1,
|
||||||
|
"sampled.b": 1,
|
||||||
|
".b": 1,
|
||||||
|
"gl_FragColor.rgba": 1,
|
||||||
|
"sampled.rgb": 1
|
||||||
|
},
|
||||||
"Gosu": {
|
"Gosu": {
|
||||||
"print": 4,
|
"print": 4,
|
||||||
"(": 54,
|
"(": 54,
|
||||||
@@ -30306,6 +30811,30 @@
|
|||||||
"say": 1,
|
"say": 1,
|
||||||
".end": 1
|
".end": 1
|
||||||
},
|
},
|
||||||
|
"Pascal": {
|
||||||
|
"program": 1,
|
||||||
|
"gmail": 1,
|
||||||
|
";": 6,
|
||||||
|
"uses": 1,
|
||||||
|
"Forms": 1,
|
||||||
|
"Unit2": 1,
|
||||||
|
"in": 1,
|
||||||
|
"{": 2,
|
||||||
|
"Form2": 2,
|
||||||
|
"}": 2,
|
||||||
|
"R": 1,
|
||||||
|
"*.res": 1,
|
||||||
|
"begin": 1,
|
||||||
|
"Application.Initialize": 1,
|
||||||
|
"Application.MainFormOnTaskbar": 1,
|
||||||
|
"True": 1,
|
||||||
|
"Application.CreateForm": 1,
|
||||||
|
"(": 1,
|
||||||
|
"TForm2": 1,
|
||||||
|
")": 1,
|
||||||
|
"Application.Run": 1,
|
||||||
|
"end.": 1
|
||||||
|
},
|
||||||
"Perl": {
|
"Perl": {
|
||||||
"package": 14,
|
"package": 14,
|
||||||
"App": 131,
|
"App": 131,
|
||||||
@@ -38683,6 +39212,89 @@
|
|||||||
"Boolean": 1,
|
"Boolean": 1,
|
||||||
"True": 1
|
"True": 1
|
||||||
},
|
},
|
||||||
|
"Volt": {
|
||||||
|
"module": 1,
|
||||||
|
"main": 2,
|
||||||
|
";": 53,
|
||||||
|
"import": 7,
|
||||||
|
"core.stdc.stdio": 1,
|
||||||
|
"core.stdc.stdlib": 1,
|
||||||
|
"watt.process": 1,
|
||||||
|
"watt.path": 1,
|
||||||
|
"results": 1,
|
||||||
|
"list": 1,
|
||||||
|
"cmd": 1,
|
||||||
|
"int": 8,
|
||||||
|
"(": 37,
|
||||||
|
")": 37,
|
||||||
|
"{": 12,
|
||||||
|
"auto": 6,
|
||||||
|
"cmdGroup": 2,
|
||||||
|
"new": 3,
|
||||||
|
"CmdGroup": 1,
|
||||||
|
"bool": 4,
|
||||||
|
"printOk": 2,
|
||||||
|
"true": 4,
|
||||||
|
"printImprovments": 2,
|
||||||
|
"printFailing": 2,
|
||||||
|
"printRegressions": 2,
|
||||||
|
"string": 1,
|
||||||
|
"compiler": 3,
|
||||||
|
"getEnv": 1,
|
||||||
|
"if": 7,
|
||||||
|
"is": 2,
|
||||||
|
"null": 3,
|
||||||
|
"printf": 6,
|
||||||
|
".ptr": 14,
|
||||||
|
"return": 2,
|
||||||
|
"-": 3,
|
||||||
|
"}": 12,
|
||||||
|
"///": 1,
|
||||||
|
"@todo": 1,
|
||||||
|
"Scan": 1,
|
||||||
|
"for": 4,
|
||||||
|
"files": 1,
|
||||||
|
"tests": 2,
|
||||||
|
"testList": 1,
|
||||||
|
"total": 5,
|
||||||
|
"passed": 5,
|
||||||
|
"failed": 5,
|
||||||
|
"improved": 3,
|
||||||
|
"regressed": 6,
|
||||||
|
"rets": 5,
|
||||||
|
"Result": 2,
|
||||||
|
"[": 6,
|
||||||
|
"]": 6,
|
||||||
|
"tests.length": 3,
|
||||||
|
"size_t": 3,
|
||||||
|
"i": 14,
|
||||||
|
"<": 3,
|
||||||
|
"+": 14,
|
||||||
|
".runTest": 1,
|
||||||
|
"cmdGroup.waitAll": 1,
|
||||||
|
"ret": 1,
|
||||||
|
"ret.ok": 1,
|
||||||
|
"cast": 5,
|
||||||
|
"ret.hasPassed": 4,
|
||||||
|
"&&": 2,
|
||||||
|
"ret.test.ptr": 4,
|
||||||
|
"ret.msg.ptr": 4,
|
||||||
|
"else": 3,
|
||||||
|
"fflush": 2,
|
||||||
|
"stdout": 1,
|
||||||
|
"xml": 8,
|
||||||
|
"fopen": 1,
|
||||||
|
"fprintf": 2,
|
||||||
|
"rets.length": 1,
|
||||||
|
".xmlLog": 1,
|
||||||
|
"fclose": 1,
|
||||||
|
"rate": 2,
|
||||||
|
"float": 2,
|
||||||
|
"/": 1,
|
||||||
|
"*": 1,
|
||||||
|
"f": 1,
|
||||||
|
"double": 1
|
||||||
|
},
|
||||||
"wisp": {
|
"wisp": {
|
||||||
";": 199,
|
";": 199,
|
||||||
"#": 2,
|
"#": 2,
|
||||||
@@ -40245,11 +40857,11 @@
|
|||||||
"C": 58732,
|
"C": 58732,
|
||||||
"C++": 21480,
|
"C++": 21480,
|
||||||
"Ceylon": 50,
|
"Ceylon": 50,
|
||||||
|
"COBOL": 90,
|
||||||
"CoffeeScript": 2951,
|
"CoffeeScript": 2951,
|
||||||
"Coq": 18259,
|
"Coq": 18259,
|
||||||
"CSS": 43867,
|
"CSS": 43867,
|
||||||
"Dart": 68,
|
"Dart": 68,
|
||||||
"Delphi": 30,
|
|
||||||
"Diff": 16,
|
"Diff": 16,
|
||||||
"Ecl": 281,
|
"Ecl": 281,
|
||||||
"edn": 227,
|
"edn": 227,
|
||||||
@@ -40259,6 +40871,7 @@
|
|||||||
"fish": 636,
|
"fish": 636,
|
||||||
"Forth": 1516,
|
"Forth": 1516,
|
||||||
"GAS": 133,
|
"GAS": 133,
|
||||||
|
"GLSL": 3766,
|
||||||
"Gosu": 413,
|
"Gosu": 413,
|
||||||
"Groovy": 69,
|
"Groovy": 69,
|
||||||
"Groovy Server Pages": 91,
|
"Groovy Server Pages": 91,
|
||||||
@@ -40298,6 +40911,7 @@
|
|||||||
"OpenEdge ABL": 762,
|
"OpenEdge ABL": 762,
|
||||||
"Parrot Assembly": 6,
|
"Parrot Assembly": 6,
|
||||||
"Parrot Internal Representation": 5,
|
"Parrot Internal Representation": 5,
|
||||||
|
"Pascal": 30,
|
||||||
"Perl": 17497,
|
"Perl": 17497,
|
||||||
"PHP": 20724,
|
"PHP": 20724,
|
||||||
"PogoScript": 250,
|
"PogoScript": 250,
|
||||||
@@ -40329,6 +40943,7 @@
|
|||||||
"VHDL": 42,
|
"VHDL": 42,
|
||||||
"VimL": 20,
|
"VimL": 20,
|
||||||
"Visual Basic": 345,
|
"Visual Basic": 345,
|
||||||
|
"Volt": 388,
|
||||||
"wisp": 1363,
|
"wisp": 1363,
|
||||||
"XC": 24,
|
"XC": 24,
|
||||||
"XML": 5622,
|
"XML": 5622,
|
||||||
@@ -40349,11 +40964,11 @@
|
|||||||
"C": 24,
|
"C": 24,
|
||||||
"C++": 20,
|
"C++": 20,
|
||||||
"Ceylon": 1,
|
"Ceylon": 1,
|
||||||
|
"COBOL": 4,
|
||||||
"CoffeeScript": 9,
|
"CoffeeScript": 9,
|
||||||
"Coq": 12,
|
"Coq": 12,
|
||||||
"CSS": 2,
|
"CSS": 2,
|
||||||
"Dart": 1,
|
"Dart": 1,
|
||||||
"Delphi": 1,
|
|
||||||
"Diff": 1,
|
"Diff": 1,
|
||||||
"Ecl": 1,
|
"Ecl": 1,
|
||||||
"edn": 1,
|
"edn": 1,
|
||||||
@@ -40363,6 +40978,7 @@
|
|||||||
"fish": 3,
|
"fish": 3,
|
||||||
"Forth": 7,
|
"Forth": 7,
|
||||||
"GAS": 1,
|
"GAS": 1,
|
||||||
|
"GLSL": 3,
|
||||||
"Gosu": 5,
|
"Gosu": 5,
|
||||||
"Groovy": 2,
|
"Groovy": 2,
|
||||||
"Groovy Server Pages": 4,
|
"Groovy Server Pages": 4,
|
||||||
@@ -40402,6 +41018,7 @@
|
|||||||
"OpenEdge ABL": 5,
|
"OpenEdge ABL": 5,
|
||||||
"Parrot Assembly": 1,
|
"Parrot Assembly": 1,
|
||||||
"Parrot Internal Representation": 1,
|
"Parrot Internal Representation": 1,
|
||||||
|
"Pascal": 1,
|
||||||
"Perl": 14,
|
"Perl": 14,
|
||||||
"PHP": 9,
|
"PHP": 9,
|
||||||
"PogoScript": 1,
|
"PogoScript": 1,
|
||||||
@@ -40433,6 +41050,7 @@
|
|||||||
"VHDL": 1,
|
"VHDL": 1,
|
||||||
"VimL": 2,
|
"VimL": 2,
|
||||||
"Visual Basic": 1,
|
"Visual Basic": 1,
|
||||||
|
"Volt": 1,
|
||||||
"wisp": 1,
|
"wisp": 1,
|
||||||
"XC": 1,
|
"XC": 1,
|
||||||
"XML": 3,
|
"XML": 3,
|
||||||
@@ -40442,5 +41060,5 @@
|
|||||||
"Xtend": 2,
|
"Xtend": 2,
|
||||||
"YAML": 1
|
"YAML": 1
|
||||||
},
|
},
|
||||||
"md5": "98ddc204696b84bb42fd75ba9d22e0ca"
|
"md5": "04aab6477c2dc5ef1be1c9de1886c3f3"
|
||||||
}
|
}
|
||||||
111
samples/LFE/church.lfe
Normal file
111
samples/LFE/church.lfe
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
;; Copyright (c) 2013 Duncan McGreggor <oubiwann@cogitat.io>
|
||||||
|
;;
|
||||||
|
;; Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
;; you may not use this file except in compliance with the License.
|
||||||
|
;; You may obtain a copy of the License at
|
||||||
|
;;
|
||||||
|
;; http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
;;
|
||||||
|
;; Unless required by applicable law or agreed to in writing, software
|
||||||
|
;; distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
;; See the License for the specific language governing permissions and
|
||||||
|
;; limitations under the License.
|
||||||
|
|
||||||
|
;; File : church.lfe
|
||||||
|
;; Author : Duncan McGreggor
|
||||||
|
;; Purpose : Demonstrating church numerals from the lambda calculus
|
||||||
|
|
||||||
|
;; The code below was used to create the section of the user guide here:
|
||||||
|
;; http://lfe.github.io/user-guide/recursion/5.html
|
||||||
|
;;
|
||||||
|
;; Here is some example usage:
|
||||||
|
;;
|
||||||
|
;; > (slurp '"church.lfe")
|
||||||
|
;; #(ok church)
|
||||||
|
;; > (zero)
|
||||||
|
;; #Fun<lfe_eval.10.53503600>
|
||||||
|
;; > (church->int1 (zero))
|
||||||
|
;; 0
|
||||||
|
;; > (church->int1 (three))
|
||||||
|
;; 3
|
||||||
|
;; > (church->int1 (five))
|
||||||
|
;; 5
|
||||||
|
;; > (church->int2 #'five/0)
|
||||||
|
;; 5
|
||||||
|
;; > (church->int2 (lambda () (get-church 25)))
|
||||||
|
;; 25
|
||||||
|
|
||||||
|
(defmodule church
|
||||||
|
(export all))
|
||||||
|
|
||||||
|
(defun zero ()
|
||||||
|
(lambda (s)
|
||||||
|
(lambda (x) x)))
|
||||||
|
|
||||||
|
(defun one ()
|
||||||
|
(lambda (s)
|
||||||
|
(lambda (x)
|
||||||
|
(funcall s x))))
|
||||||
|
|
||||||
|
(defun two ()
|
||||||
|
(lambda (s)
|
||||||
|
(lambda (x)
|
||||||
|
(funcall s
|
||||||
|
(funcall s x)))))
|
||||||
|
|
||||||
|
(defun three ()
|
||||||
|
(lambda (s)
|
||||||
|
(lambda (x)
|
||||||
|
(funcall s
|
||||||
|
(funcall s
|
||||||
|
(funcall s x))))))
|
||||||
|
|
||||||
|
(defun four ()
|
||||||
|
(lambda (s)
|
||||||
|
(lambda (x)
|
||||||
|
(funcall s
|
||||||
|
(funcall s
|
||||||
|
(funcall s
|
||||||
|
(funcall s x)))))))
|
||||||
|
|
||||||
|
(defun five ()
|
||||||
|
(get-church 5))
|
||||||
|
|
||||||
|
(defun int-successor (n)
|
||||||
|
(+ n 1))
|
||||||
|
|
||||||
|
(defun church->int1 (church-numeral)
|
||||||
|
"
|
||||||
|
Converts a called church numeral to an integer, e.g.:
|
||||||
|
> (church->int1 (five))
|
||||||
|
"
|
||||||
|
(funcall
|
||||||
|
(funcall church-numeral #'int-successor/1) 0))
|
||||||
|
|
||||||
|
(defun church->int2 (church-numeral)
|
||||||
|
"
|
||||||
|
Converts a non-called church numeral to an integer, e.g.:
|
||||||
|
> (church->int2 #'five/0)
|
||||||
|
"
|
||||||
|
(funcall
|
||||||
|
(funcall
|
||||||
|
(funcall church-numeral) #'int-successor/1) 0))
|
||||||
|
|
||||||
|
(defun church-successor (church-numeral)
|
||||||
|
(lambda (s)
|
||||||
|
(lambda (x)
|
||||||
|
(funcall s
|
||||||
|
(funcall
|
||||||
|
(funcall church-numeral s) x)))))
|
||||||
|
|
||||||
|
(defun get-church (church-numeral count limit)
|
||||||
|
(cond ((== count limit) church-numeral)
|
||||||
|
((/= count limit)
|
||||||
|
(get-church
|
||||||
|
(church-successor church-numeral)
|
||||||
|
(+ 1 count)
|
||||||
|
limit))))
|
||||||
|
|
||||||
|
(defun get-church (integer)
|
||||||
|
(get-church (zero) 0 integer))
|
||||||
104
samples/LFE/gps1.lfe
Normal file
104
samples/LFE/gps1.lfe
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
;;; -*- Mode: LFE; -*-
|
||||||
|
;;; Code from Paradigms of Artificial Intelligence Programming
|
||||||
|
;;; Copyright (c) 1991 Peter Norvig
|
||||||
|
|
||||||
|
;;;; File gps1.lisp: First version of GPS (General Problem Solver)
|
||||||
|
|
||||||
|
;;;; Converted to LFE by Robert Virding
|
||||||
|
|
||||||
|
;; Define macros for global variable access. This is a hack and very naughty!
|
||||||
|
(defsyntax defvar
|
||||||
|
([name val] (let ((v val)) (put 'name v) v)))
|
||||||
|
|
||||||
|
(defsyntax setvar
|
||||||
|
([name val] (let ((v val)) (put 'name v) v)))
|
||||||
|
|
||||||
|
(defsyntax getvar
|
||||||
|
([name] (get 'name)))
|
||||||
|
|
||||||
|
;; Module definition.
|
||||||
|
|
||||||
|
(defmodule gps1
|
||||||
|
(export (gps 2) (gps 3) (school-ops 0))
|
||||||
|
(import (from lists (member 2) (all 2) (any 2))
|
||||||
|
;; Rename lists functions to be more CL like.
|
||||||
|
(rename lists ((all 2) every) ((any 2) some) ((filter 2) find-all))))
|
||||||
|
|
||||||
|
;; An operation.
|
||||||
|
(defrecord op
|
||||||
|
action preconds add-list del-list)
|
||||||
|
|
||||||
|
;; General Problem Solver: achieve all goals using *ops*.
|
||||||
|
(defun gps (state goals ops)
|
||||||
|
;; Set global variables
|
||||||
|
(defvar *state* state) ;The current state: a list of conditions.
|
||||||
|
(defvar *ops* ops) ;A list of available operators.
|
||||||
|
(if (every (fun achieve 1) goals) 'solved))
|
||||||
|
|
||||||
|
(defun gps (state goals)
|
||||||
|
;; Set global variables, but use existing *ops*
|
||||||
|
(defvar *state* state) ;The current state: a list of conditions.
|
||||||
|
(if (every (fun achieve 1) goals) 'solved))
|
||||||
|
|
||||||
|
;; A goal is achieved if it already holds or if there is an
|
||||||
|
;; appropriate op for it that is applicable."
|
||||||
|
(defun achieve (goal)
|
||||||
|
(orelse (member goal (getvar *state*))
|
||||||
|
(some (fun apply-op 1)
|
||||||
|
(find-all (lambda (op) (appropriate-p goal op))
|
||||||
|
(getvar *ops*)))))
|
||||||
|
|
||||||
|
;; An op is appropriate to a goal if it is in its add list.
|
||||||
|
(defun appropriate-p (goal op)
|
||||||
|
(member goal (op-add-list op)))
|
||||||
|
|
||||||
|
;; Print a message and update *state* if op is applicable.
|
||||||
|
(defun apply-op (op)
|
||||||
|
(if (every (fun achieve 1) (op-preconds op))
|
||||||
|
(progn
|
||||||
|
(: io fwrite '"executing ~p\n" (list (op-action op)))
|
||||||
|
(setvar *state* (set-difference (getvar *state*) (op-del-list op)))
|
||||||
|
(setvar *state* (union (getvar *state*) (op-add-list op)))
|
||||||
|
'true)))
|
||||||
|
|
||||||
|
;; Define the set functions to work on list, a listsets module really.
|
||||||
|
(defun set-difference
|
||||||
|
([(cons e es) s2]
|
||||||
|
(if (member e s2)
|
||||||
|
(set-difference es s2)
|
||||||
|
(cons e (set-difference es s2))))
|
||||||
|
([() s2] ()))
|
||||||
|
|
||||||
|
(defun union
|
||||||
|
([(cons e es) s2]
|
||||||
|
(if (member e s2) (union es s2) (cons e (union es s2))))
|
||||||
|
([() s2] ()))
|
||||||
|
|
||||||
|
;;; ==============================
|
||||||
|
|
||||||
|
(defun school-ops ()
|
||||||
|
(list
|
||||||
|
(make-op action 'drive-son-to-school
|
||||||
|
preconds '(son-at-home car-works)
|
||||||
|
add-list '(son-at-school)
|
||||||
|
del-list '(son-at-home))
|
||||||
|
(make-op action 'shop-installs-battery
|
||||||
|
preconds '(car-needs-battery shop-knows-problem shop-has-money)
|
||||||
|
add-list '(car-works)
|
||||||
|
del-list ())
|
||||||
|
(make-op action 'tell-shop-problem
|
||||||
|
preconds '(in-communication-with-shop)
|
||||||
|
add-list '(shop-knows-problem)
|
||||||
|
del-list ())
|
||||||
|
(make-op action 'telephone-shop
|
||||||
|
preconds '(know-phone-number)
|
||||||
|
add-list '(in-communication-with-shop)
|
||||||
|
del-list ())
|
||||||
|
(make-op action 'look-up-number
|
||||||
|
preconds '(have-phone-book)
|
||||||
|
add-list '(know-phone-number)
|
||||||
|
del-list ())
|
||||||
|
(make-op action 'give-shop-money
|
||||||
|
preconds '(have-money)
|
||||||
|
add-list '(shop-has-money)
|
||||||
|
del-list '(have-money))))
|
||||||
83
samples/LFE/mnesia_demo.lfe
Normal file
83
samples/LFE/mnesia_demo.lfe
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
;; Copyright (c) 2008-2013 Robert Virding
|
||||||
|
;;
|
||||||
|
;; Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
;; you may not use this file except in compliance with the License.
|
||||||
|
;; You may obtain a copy of the License at
|
||||||
|
;;
|
||||||
|
;; http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
;;
|
||||||
|
;; Unless required by applicable law or agreed to in writing, software
|
||||||
|
;; distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
;; See the License for the specific language governing permissions and
|
||||||
|
;; limitations under the License.
|
||||||
|
|
||||||
|
;; File : mnesia_demo.lfe
|
||||||
|
;; Author : Robert Virding
|
||||||
|
;; Purpose : A simple Mnesia demo file for LFE.
|
||||||
|
|
||||||
|
;; This file contains a simple demo of using LFE to access Mnesia
|
||||||
|
;; tables. It shows how to use the emp-XXXX macro (ETS match pattern)
|
||||||
|
;; together with mnesia:match_object, match specifications with
|
||||||
|
;; mnesia:select and Query List Comprehensions.
|
||||||
|
|
||||||
|
(defmodule mnesia_demo
|
||||||
|
(export (new 0) (by_place 1) (by_place_ms 1) (by_place_qlc 1)))
|
||||||
|
|
||||||
|
(defrecord person name place job)
|
||||||
|
|
||||||
|
(defun new ()
|
||||||
|
;; Start mnesia and create a table, we will get an in memory only schema.
|
||||||
|
(: mnesia start)
|
||||||
|
(: mnesia create_table 'person '(#(attributes (name place job))))
|
||||||
|
;; Initialise the table.
|
||||||
|
(let ((people '(
|
||||||
|
;; First some people in London.
|
||||||
|
#(fred london waiter)
|
||||||
|
#(bert london waiter)
|
||||||
|
#(john london painter)
|
||||||
|
#(paul london driver)
|
||||||
|
;; Now some in Paris.
|
||||||
|
#(jean paris waiter)
|
||||||
|
#(gerard paris driver)
|
||||||
|
#(claude paris painter)
|
||||||
|
#(yves paris waiter)
|
||||||
|
;; And some in Rome.
|
||||||
|
#(roberto rome waiter)
|
||||||
|
#(guiseppe rome driver)
|
||||||
|
#(paulo rome painter)
|
||||||
|
;; And some in Berlin.
|
||||||
|
#(fritz berlin painter)
|
||||||
|
#(kurt berlin driver)
|
||||||
|
#(hans berlin waiter)
|
||||||
|
#(franz berlin waiter)
|
||||||
|
)))
|
||||||
|
(: lists foreach (match-lambda
|
||||||
|
([(tuple n p j)]
|
||||||
|
(: mnesia transaction
|
||||||
|
(lambda ()
|
||||||
|
(let ((new (make-person name n place p job j)))
|
||||||
|
(: mnesia write new))))))
|
||||||
|
people)))
|
||||||
|
|
||||||
|
;; Match records by place using match_object and the emp-XXXX macro.
|
||||||
|
(defun by_place (place)
|
||||||
|
(: mnesia transaction
|
||||||
|
(lambda () (: mnesia match_object (emp-person place place)))))
|
||||||
|
|
||||||
|
;; Use match specifications to match records
|
||||||
|
(defun by_place_ms (place)
|
||||||
|
(let ((f (lambda () (: mnesia select 'person
|
||||||
|
(match-spec ([(match-person name n place p job j)]
|
||||||
|
(when (=:= p place))
|
||||||
|
(tuple n j)))))))
|
||||||
|
(: mnesia transaction f)))
|
||||||
|
|
||||||
|
;; Use Query List Comprehensions to match records
|
||||||
|
(defun by_place_qlc (place)
|
||||||
|
(let ((f (lambda ()
|
||||||
|
(let ((q (qlc (lc ((<- person (: mnesia table 'person))
|
||||||
|
(=:= (person-place person) place))
|
||||||
|
person))))
|
||||||
|
(: qlc e q)))))
|
||||||
|
(: mnesia transaction f)))
|
||||||
169
samples/LFE/object.lfe
Normal file
169
samples/LFE/object.lfe
Normal file
@@ -0,0 +1,169 @@
|
|||||||
|
;; Copyright (c) 2013 Duncan McGreggor <oubiwann@cogitat.io>
|
||||||
|
;;
|
||||||
|
;; Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
;; you may not use this file except in compliance with the License.
|
||||||
|
;; You may obtain a copy of the License at
|
||||||
|
;;
|
||||||
|
;; http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
;;
|
||||||
|
;; Unless required by applicable law or agreed to in writing, software
|
||||||
|
;; distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
;; See the License for the specific language governing permissions and
|
||||||
|
;; limitations under the License.
|
||||||
|
|
||||||
|
;; File : object.lfe
|
||||||
|
;; Author : Duncan McGreggor
|
||||||
|
;; Purpose : Demonstrating simple OOP with closures
|
||||||
|
|
||||||
|
;; The simple object system demonstrated below shows how to do the following:
|
||||||
|
;; * create objects
|
||||||
|
;; * call methods on those objects
|
||||||
|
;; * have methods which can call other methods
|
||||||
|
;; * update the state of an instance variable
|
||||||
|
;;
|
||||||
|
;; Note, however, that his example does not demonstrate inheritance.
|
||||||
|
;;
|
||||||
|
;; To use the code below in LFE, do the following:
|
||||||
|
;;
|
||||||
|
;; $ cd examples
|
||||||
|
;; $ ../bin/lfe -pa ../ebin
|
||||||
|
;;
|
||||||
|
;; Load the file and create a fish-class instance:
|
||||||
|
;;
|
||||||
|
;; > (slurp '"object.lfe")
|
||||||
|
;; #(ok object)
|
||||||
|
;; > (set mommy-fish (fish-class '"Carp"))
|
||||||
|
;; #Fun<lfe_eval.10.91765564>
|
||||||
|
;;
|
||||||
|
;; Execute some of the basic methods:
|
||||||
|
;;
|
||||||
|
;; > (get-species mommy-fish)
|
||||||
|
;; "Carp"
|
||||||
|
;; > (move mommy-fish 17)
|
||||||
|
;; The Carp swam 17 feet!
|
||||||
|
;; ok
|
||||||
|
;; > (get-id mommy-fish)
|
||||||
|
;; "47eebe91a648f042fc3fb278df663de5"
|
||||||
|
;;
|
||||||
|
;; Now let's look at "modifying" state data (e.g., children counts):
|
||||||
|
;;
|
||||||
|
;; > (get-children mommy-fish)
|
||||||
|
;; ()
|
||||||
|
;; > (get-children-count mommy-fish)
|
||||||
|
;; 0
|
||||||
|
;; > (set (mommy-fish baby-fish-1) (reproduce mommy-fish))
|
||||||
|
;; (#Fun<lfe_eval.10.91765564> #Fun<lfe_eval.10.91765564>)
|
||||||
|
;; > (get-id mommy-fish)
|
||||||
|
;; "47eebe91a648f042fc3fb278df663de5"
|
||||||
|
;; > (get-id baby-fish-1)
|
||||||
|
;; "fdcf35983bb496650e558a82e34c9935"
|
||||||
|
;; > (get-children-count mommy-fish)
|
||||||
|
;; 1
|
||||||
|
;; > (set (mommy-fish baby-fish-2) (reproduce mommy-fish))
|
||||||
|
;; (#Fun<lfe_eval.10.91765564> #Fun<lfe_eval.10.91765564>)
|
||||||
|
;; > (get-id mommy-fish)
|
||||||
|
;; "47eebe91a648f042fc3fb278df663de5"
|
||||||
|
;; > (get-id baby-fish-2)
|
||||||
|
;; "3e64e5c20fb742dd88dac1032749c2fd"
|
||||||
|
;; > (get-children-count mommy-fish)
|
||||||
|
;; 2
|
||||||
|
;; > (get-info mommy-fish)
|
||||||
|
;; id: "47eebe91a648f042fc3fb278df663de5"
|
||||||
|
;; species: "Carp"
|
||||||
|
;; children: ["fdcf35983bb496650e558a82e34c9935",
|
||||||
|
;; "3e64e5c20fb742dd88dac1032749c2fd"]
|
||||||
|
;; ok
|
||||||
|
|
||||||
|
(defmodule object
|
||||||
|
(export all))
|
||||||
|
|
||||||
|
(defun fish-class (species)
|
||||||
|
"
|
||||||
|
This is the constructor that will be used most often, only requiring that
|
||||||
|
one pass a 'species' string.
|
||||||
|
|
||||||
|
When the children are not defined, simply use an empty list.
|
||||||
|
"
|
||||||
|
(fish-class species ()))
|
||||||
|
|
||||||
|
(defun fish-class (species children)
|
||||||
|
"
|
||||||
|
This contructor is mostly useful as a way of abstracting out the id
|
||||||
|
generation from the larger constructor. Nothing else uses fish-class/2
|
||||||
|
besides fish-class/1, so it's not strictly necessary.
|
||||||
|
|
||||||
|
When the id isn't know, generate one."
|
||||||
|
(let* (((binary (id (size 128))) (: crypto rand_bytes 16))
|
||||||
|
(formatted-id (car
|
||||||
|
(: io_lib format
|
||||||
|
'"~32.16.0b" (list id)))))
|
||||||
|
(fish-class species children formatted-id)))
|
||||||
|
|
||||||
|
(defun fish-class (species children id)
|
||||||
|
"
|
||||||
|
This is the constructor used internally, once the children and fish id are
|
||||||
|
known.
|
||||||
|
"
|
||||||
|
(let ((move-verb '"swam"))
|
||||||
|
(lambda (method-name)
|
||||||
|
(case method-name
|
||||||
|
('id
|
||||||
|
(lambda (self) id))
|
||||||
|
('species
|
||||||
|
(lambda (self) species))
|
||||||
|
('children
|
||||||
|
(lambda (self) children))
|
||||||
|
('info
|
||||||
|
(lambda (self)
|
||||||
|
(: io format
|
||||||
|
'"id: ~p~nspecies: ~p~nchildren: ~p~n"
|
||||||
|
(list (get-id self)
|
||||||
|
(get-species self)
|
||||||
|
(get-children self)))))
|
||||||
|
('move
|
||||||
|
(lambda (self distance)
|
||||||
|
(: io format
|
||||||
|
'"The ~s ~s ~p feet!~n"
|
||||||
|
(list species move-verb distance))))
|
||||||
|
('reproduce
|
||||||
|
(lambda (self)
|
||||||
|
(let* ((child (fish-class species))
|
||||||
|
(child-id (get-id child))
|
||||||
|
(children-ids (: lists append
|
||||||
|
(list children (list child-id))))
|
||||||
|
(parent-id (get-id self))
|
||||||
|
(parent (fish-class species children-ids parent-id)))
|
||||||
|
(list parent child))))
|
||||||
|
('children-count
|
||||||
|
(lambda (self)
|
||||||
|
(: erlang length children)))))))
|
||||||
|
|
||||||
|
(defun get-method (object method-name)
|
||||||
|
"
|
||||||
|
This is a generic function, used to call into the given object (class
|
||||||
|
instance).
|
||||||
|
"
|
||||||
|
(funcall object method-name))
|
||||||
|
|
||||||
|
; define object methods
|
||||||
|
(defun get-id (object)
|
||||||
|
(funcall (get-method object 'id) object))
|
||||||
|
|
||||||
|
(defun get-species (object)
|
||||||
|
(funcall (get-method object 'species) object))
|
||||||
|
|
||||||
|
(defun get-info (object)
|
||||||
|
(funcall (get-method object 'info) object))
|
||||||
|
|
||||||
|
(defun move (object distance)
|
||||||
|
(funcall (get-method object 'move) object distance))
|
||||||
|
|
||||||
|
(defun reproduce (object)
|
||||||
|
(funcall (get-method object 'reproduce) object))
|
||||||
|
|
||||||
|
(defun get-children (object)
|
||||||
|
(funcall (get-method object 'children) object))
|
||||||
|
|
||||||
|
(defun get-children-count (object)
|
||||||
|
(funcall (get-method object 'children-count) object))
|
||||||
56
samples/Squirrel/Squirrel.nut
Normal file
56
samples/Squirrel/Squirrel.nut
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
//example from http://www.squirrel-lang.org/#documentation
|
||||||
|
|
||||||
|
local table = {
|
||||||
|
a = "10"
|
||||||
|
subtable = {
|
||||||
|
array = [1,2,3]
|
||||||
|
},
|
||||||
|
[10 + 123] = "expression index"
|
||||||
|
}
|
||||||
|
|
||||||
|
local array=[ 1, 2, 3, { a = 10, b = "string" } ];
|
||||||
|
|
||||||
|
foreach (i,val in array)
|
||||||
|
{
|
||||||
|
::print("the type of val is"+typeof val);
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////
|
||||||
|
|
||||||
|
class Entity
|
||||||
|
{
|
||||||
|
constructor(etype,entityname)
|
||||||
|
{
|
||||||
|
name = entityname;
|
||||||
|
type = etype;
|
||||||
|
}
|
||||||
|
|
||||||
|
x = 0;
|
||||||
|
y = 0;
|
||||||
|
z = 0;
|
||||||
|
name = null;
|
||||||
|
type = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Entity::MoveTo(newx,newy,newz)
|
||||||
|
{
|
||||||
|
x = newx;
|
||||||
|
y = newy;
|
||||||
|
z = newz;
|
||||||
|
}
|
||||||
|
|
||||||
|
class Player extends Entity {
|
||||||
|
constructor(entityname)
|
||||||
|
{
|
||||||
|
base.constructor("Player",entityname)
|
||||||
|
}
|
||||||
|
function DoDomething()
|
||||||
|
{
|
||||||
|
::print("something");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
local newplayer = Player("da playar");
|
||||||
|
|
||||||
|
newplayer.MoveTo(100,200,300);
|
||||||
@@ -191,7 +191,10 @@ class TestLanguage < Test::Unit::TestCase
|
|||||||
|
|
||||||
def test_markup
|
def test_markup
|
||||||
assert_equal :markup, Language['HTML'].type
|
assert_equal :markup, Language['HTML'].type
|
||||||
assert_equal :markup, Language['YAML'].type
|
end
|
||||||
|
|
||||||
|
def test_data
|
||||||
|
assert_equal :data, Language['YAML'].type
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_other
|
def test_other
|
||||||
|
|||||||
Reference in New Issue
Block a user