mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Merge branch 'master' into updated-922
Conflicts: lib/linguist/samples.json
This commit is contained in:
@@ -1082,6 +1082,11 @@ Mask:
|
||||
ace_mode: scss
|
||||
primary_extension: .mask
|
||||
|
||||
Mathematica:
|
||||
type: programming
|
||||
primary_extension: .mathematica
|
||||
lexer: Text only
|
||||
|
||||
Matlab:
|
||||
type: programming
|
||||
color: "#bb92ac"
|
||||
|
||||
@@ -247,6 +247,9 @@
|
||||
"Mask": [
|
||||
".mask"
|
||||
],
|
||||
"Mathematica": [
|
||||
".m"
|
||||
],
|
||||
"Matlab": [
|
||||
".m"
|
||||
],
|
||||
@@ -572,8 +575,8 @@
|
||||
".gemrc"
|
||||
]
|
||||
},
|
||||
"tokens_total": 456279,
|
||||
"languages_total": 566,
|
||||
"tokens_total": 456690,
|
||||
"languages_total": 569,
|
||||
"tokens": {
|
||||
"ABAP": {
|
||||
"*/**": 1,
|
||||
@@ -30741,6 +30744,84 @@
|
||||
"footer": 1,
|
||||
"bazCompo": 1
|
||||
},
|
||||
"Mathematica": {
|
||||
"Get": 1,
|
||||
"[": 74,
|
||||
"]": 73,
|
||||
"Paclet": 1,
|
||||
"Name": 1,
|
||||
"-": 8,
|
||||
"Version": 1,
|
||||
"MathematicaVersion": 1,
|
||||
"Description": 1,
|
||||
"Creator": 1,
|
||||
"Extensions": 1,
|
||||
"{": 2,
|
||||
"Language": 1,
|
||||
"MainPage": 1,
|
||||
"}": 2,
|
||||
"BeginPackage": 1,
|
||||
";": 41,
|
||||
"PossiblyTrueQ": 3,
|
||||
"usage": 22,
|
||||
"PossiblyFalseQ": 2,
|
||||
"PossiblyNonzeroQ": 3,
|
||||
"Begin": 2,
|
||||
"expr_": 4,
|
||||
"Not": 6,
|
||||
"TrueQ": 4,
|
||||
"expr": 4,
|
||||
"End": 2,
|
||||
"AnyQ": 3,
|
||||
"AnyElementQ": 4,
|
||||
"AllQ": 2,
|
||||
"AllElementQ": 2,
|
||||
"AnyNonzeroQ": 2,
|
||||
"AnyPossiblyNonzeroQ": 2,
|
||||
"RealQ": 3,
|
||||
"PositiveQ": 3,
|
||||
"NonnegativeQ": 3,
|
||||
"PositiveIntegerQ": 3,
|
||||
"NonnegativeIntegerQ": 4,
|
||||
"IntegerListQ": 5,
|
||||
"PositiveIntegerListQ": 3,
|
||||
"NonnegativeIntegerListQ": 3,
|
||||
"IntegerOrListQ": 2,
|
||||
"PositiveIntegerOrListQ": 2,
|
||||
"NonnegativeIntegerOrListQ": 2,
|
||||
"SymbolQ": 2,
|
||||
"SymbolOrNumberQ": 2,
|
||||
"cond_": 4,
|
||||
"L_": 5,
|
||||
"Fold": 3,
|
||||
"Or": 1,
|
||||
"False": 4,
|
||||
"cond": 4,
|
||||
"/@": 3,
|
||||
"L": 4,
|
||||
"Flatten": 1,
|
||||
"And": 4,
|
||||
"True": 2,
|
||||
"SHEBANG#!#!=": 1,
|
||||
"n_": 5,
|
||||
"Im": 1,
|
||||
"n": 8,
|
||||
"Positive": 2,
|
||||
"IntegerQ": 3,
|
||||
"&&": 4,
|
||||
"input_": 6,
|
||||
"ListQ": 1,
|
||||
"input": 11,
|
||||
"MemberQ": 3,
|
||||
"IntegerQ/@input": 1,
|
||||
"||": 4,
|
||||
"a_": 2,
|
||||
"Head": 2,
|
||||
"a": 3,
|
||||
"Symbol": 2,
|
||||
"NumericQ": 1,
|
||||
"EndPackage": 1
|
||||
},
|
||||
"Matlab": {
|
||||
"function": 34,
|
||||
"[": 311,
|
||||
@@ -49563,6 +49644,7 @@
|
||||
"Makefile": 50,
|
||||
"Markdown": 1,
|
||||
"Mask": 74,
|
||||
"Mathematica": 411,
|
||||
"Matlab": 11942,
|
||||
"Max": 714,
|
||||
"MediaWiki": 766,
|
||||
@@ -49713,6 +49795,7 @@
|
||||
"Makefile": 2,
|
||||
"Markdown": 1,
|
||||
"Mask": 1,
|
||||
"Mathematica": 3,
|
||||
"Matlab": 39,
|
||||
"Max": 3,
|
||||
"MediaWiki": 1,
|
||||
@@ -49790,5 +49873,5 @@
|
||||
"Xtend": 2,
|
||||
"YAML": 2
|
||||
},
|
||||
"md5": "df13bc8f133300e197989b7934998e7c"
|
||||
"md5": "369eb61211321cd0a217de22110731ac"
|
||||
}
|
||||
3
samples/Mathematica/Init.m
Normal file
3
samples/Mathematica/Init.m
Normal file
@@ -0,0 +1,3 @@
|
||||
(* Mathematica Init File *)
|
||||
|
||||
Get[ "Foobar`Foobar`"]
|
||||
17
samples/Mathematica/PacletInfo.m
Normal file
17
samples/Mathematica/PacletInfo.m
Normal file
@@ -0,0 +1,17 @@
|
||||
(* Paclet Info File *)
|
||||
|
||||
(* created 2014/02/07*)
|
||||
|
||||
Paclet[
|
||||
Name -> "Foobar",
|
||||
Version -> "0.0.1",
|
||||
MathematicaVersion -> "8+",
|
||||
Description -> "Example of an automatically generated PacletInfo file.",
|
||||
Creator -> "Chris Granade",
|
||||
Extensions ->
|
||||
{
|
||||
{"Documentation", Language -> "English", MainPage -> "Guides/Foobar"}
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
150
samples/Mathematica/Predicates.m
Normal file
150
samples/Mathematica/Predicates.m
Normal file
@@ -0,0 +1,150 @@
|
||||
(* ::Package:: *)
|
||||
|
||||
BeginPackage["Predicates`"];
|
||||
|
||||
|
||||
(* ::Title:: *)
|
||||
(*Predicates*)
|
||||
|
||||
|
||||
(* ::Section::Closed:: *)
|
||||
(*Fuzzy Logic*)
|
||||
|
||||
|
||||
(* ::Subsection:: *)
|
||||
(*Documentation*)
|
||||
|
||||
|
||||
PossiblyTrueQ::usage="Returns True if the argument is not definitely False.";
|
||||
PossiblyFalseQ::usage="Returns True if the argument is not definitely True.";
|
||||
PossiblyNonzeroQ::usage="Returns True if and only if its argument is not definitely zero.";
|
||||
|
||||
|
||||
(* ::Subsection:: *)
|
||||
(*Implimentation*)
|
||||
|
||||
|
||||
Begin["`Private`"];
|
||||
|
||||
|
||||
PossiblyTrueQ[expr_]:=\[Not]TrueQ[\[Not]expr]
|
||||
|
||||
|
||||
PossiblyFalseQ[expr_]:=\[Not]TrueQ[expr]
|
||||
|
||||
|
||||
End[];
|
||||
|
||||
|
||||
(* ::Section::Closed:: *)
|
||||
(*Numbers and Lists*)
|
||||
|
||||
|
||||
(* ::Subsection:: *)
|
||||
(*Documentation*)
|
||||
|
||||
|
||||
AnyQ::usage="Given a predicate and a list, retuns True if and only if that predicate is True for at least one element of the list.";
|
||||
AnyElementQ::usage="Returns True if cond matches any element of L.";
|
||||
AllQ::usage="Given a predicate and a list, retuns True if and only if that predicate is True for all elements of the list.";
|
||||
AllElementQ::usage="Returns True if cond matches any element of L.";
|
||||
|
||||
|
||||
AnyNonzeroQ::usage="Returns True if L is a list such that at least one element is definitely not zero.";
|
||||
AnyPossiblyNonzeroQ::usage="Returns True if expr is a list such that at least one element is not definitely zero.";
|
||||
|
||||
|
||||
RealQ::usage="Returns True if and only if the argument is a real number";
|
||||
PositiveQ::usage="Returns True if and only if the argument is a positive real number";
|
||||
NonnegativeQ::usage="Returns True if and only if the argument is a non-negative real number";
|
||||
PositiveIntegerQ::usage="Returns True if and only if the argument is a positive integer";
|
||||
NonnegativeIntegerQ::usage="Returns True if and only if the argument is a non-negative integer";
|
||||
|
||||
|
||||
IntegerListQ::usage="Returns True if and only if the input is a list of integers.";
|
||||
PositiveIntegerListQ::usage="Returns True if and only if the input is a list of positive integers.";
|
||||
NonnegativeIntegerListQ::usage="Returns True if and only if the input is a list of non-negative integers.";
|
||||
IntegerOrListQ::usage="Returns True if and only if the input is a list of integers or an integer.";
|
||||
PositiveIntegerOrListQ::usage="Returns True if and only if the input is a list of positive integers or a positive integer.";
|
||||
NonnegativeIntegerOrListQ::usage="Returns True if and only if the input is a list of positive integers or a positive integer.";
|
||||
|
||||
|
||||
SymbolQ::usage="Returns True if argument is an unassigned symbol.";
|
||||
SymbolOrNumberQ::usage="Returns True if argument is a number of has head 'Symbol'";
|
||||
|
||||
|
||||
(* ::Subsection:: *)
|
||||
(*Implimentation*)
|
||||
|
||||
|
||||
Begin["`Private`"];
|
||||
|
||||
|
||||
AnyQ[cond_, L_] := Fold[Or, False, cond /@ L]
|
||||
|
||||
|
||||
AnyElementQ[cond_,L_]:=AnyQ[cond,Flatten[L]]
|
||||
|
||||
|
||||
AllQ[cond_, L_] := Fold[And, True, cond /@ L]
|
||||
|
||||
|
||||
AllElementQ[cond_, L_] := Fold[And, True, cond /@ L]
|
||||
|
||||
|
||||
AnyNonzeroQ[L_]:=AnyElementQ[#!=0&,L]
|
||||
|
||||
|
||||
PossiblyNonzeroQ[expr_]:=PossiblyTrueQ[expr!=0]
|
||||
|
||||
|
||||
AnyPossiblyNonzeroQ[expr_]:=AnyElementQ[PossiblyNonzeroQ,expr]
|
||||
|
||||
|
||||
RealQ[n_]:=TrueQ[Im[n]==0];
|
||||
|
||||
|
||||
PositiveQ[n_]:=Positive[n];
|
||||
|
||||
|
||||
PositiveIntegerQ[n_]:=PositiveQ[n]\[And]IntegerQ[n];
|
||||
|
||||
|
||||
NonnegativeQ[n_]:=TrueQ[RealQ[n]&&n>=0];
|
||||
|
||||
|
||||
NonnegativeIntegerQ[n_]:=NonnegativeQ[n]\[And]IntegerQ[n];
|
||||
|
||||
|
||||
IntegerListQ[input_]:=ListQ[input]&&Not[MemberQ[IntegerQ/@input,False]];
|
||||
|
||||
|
||||
IntegerOrListQ[input_]:=IntegerListQ[input]||IntegerQ[input];
|
||||
|
||||
|
||||
PositiveIntegerListQ[input_]:=IntegerListQ[input]&&Not[MemberQ[Positive[input],False]];
|
||||
|
||||
|
||||
PositiveIntegerOrListQ[input_]:=PositiveIntegerListQ[input]||PositiveIntegerQ[input];
|
||||
|
||||
|
||||
NonnegativeIntegerListQ[input_]:=IntegerListQ[input]&&Not[MemberQ[NonnegativeIntegerQ[input],False]];
|
||||
|
||||
|
||||
NonnegativeIntegerOrListQ[input_]:=NonnegativeIntegerListQ[input]||NonnegativeIntegerQ[input];
|
||||
|
||||
|
||||
SymbolQ[a_]:=Head[a]===Symbol;
|
||||
|
||||
|
||||
SymbolOrNumberQ[a_]:=NumericQ[a]||Head[a]===Symbol;
|
||||
|
||||
|
||||
End[];
|
||||
|
||||
|
||||
(* ::Section:: *)
|
||||
(*Epilogue*)
|
||||
|
||||
|
||||
EndPackage[];
|
||||
Reference in New Issue
Block a user