This is wonderful comment I have to say.I have not think about it before this.As the promption,I get into the page of GeneralUtilities`PrintDefinitions,Then I click Definitions->KernelPlaceholderDefs,I have got this information:
KernelPlaceholderDefs[sym_Symbol] := If[!HasAnyCodesQ[sym],
{},
DeleteCases[Null][
{
If[HasOwnCodeQ[sym],
HoldPattern[sym] :> $KernelFunctionPlaceholder
],
If[HasDownCodeQ[sym],
HoldPattern[sym[___]] :> $KernelFunctionPlaceholder
],
If[HasSubCodeQ[sym],
HoldPattern[sym[___][___]] :> $KernelFunctionPlaceholder
],
If[HasUpCodeQ[sym],
HoldPattern[_[___, sym, ___]] :> $KernelFunctionPlaceholder
],
If[HasPrintCodeQ[sym],
HoldPattern[Format[sym, _]] :> $KernelFunctionPlaceholder
]
}
]
];
Attributes[KernelPlaceholderDefs] := {HoldAll};
So the function System`Private`HasAnyCodesQ can judge the function is kernel function or not.Maybe is all of in a local file GeneralUtilities`PackageScope`$KernelFunctionPlaceholder but I don't know how to open it,we can get it all by following code:
kernelFunctions =
Quiet[Select[
ToExpression[CanonicalName[EntityList["WolframLanguageSymbol"]]],
System`Private`HasAnyCodesQ]]
{$AssertFunction,Identity,Identity,Abort,AbortProtect,Abs,AbsArg,AbsoluteFileName,AbsoluteTime,AbsoluteTiming,Accumulate,Accuracy,Activate,AcyclicGraphQ,AddTo,AdjacencyList,AdjacencyMatrix,AffineHalfSpace,AffineSpace,AiryAi,AiryAiPrime,AiryBi,AiryBiPrime,AlgebraicIntegerQ,AlgebraicNumber,AlgebraicNumberDenominator,AlgebraicNumberNorm,AlgebraicNumberTrace,AlgebraicUnitQ,AllTrue,...}
A total of $\color{red}{1341}$ kernel function that we can not use GeneralUtilities`PrintDefinitions to get it's definition.And we can see the kernel function is classifid 5 kinds by WR,such as HasOwnCodeQ,HasDownCodeQ,HasSubCodeQ,HasUpCodeQ and HasPrintCodeQ.
PrintDefinitions[PrintDefinitions]tell you how that's implemented? – ilian Oct 30 '16 at 16:08HasOwnCodeQ,HasDownCodeQ,HasSubCodeQ,HasUpCodeQ,HowPrintCodeQwill only return true if it's implemented internally. They don't catchOwnValues,DownValue,SubValues,UpValues,orFormatValues. – b3m2a1 Sep 17 '17 at 06:49