Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
11
Task/Call-a-function/Dyalect/call-a-function-9.dyalect
Normal file
11
Task/Call-a-function/Dyalect/call-a-function-9.dyalect
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
//Built-in functions are regular functions from an implicitly imported "lang" module
|
||||
//There is no actual difference between these functions and user-defined functions
|
||||
|
||||
//You can however write a function that would check if a given function is declared in "lang" module:
|
||||
func isBuiltin(fn) =>
|
||||
fn.Name is not nil && fn.Name in lang && lang[fn.Name] == fn
|
||||
|
||||
//Usage:
|
||||
func foo() { } //A user-defined function
|
||||
print(isBuiltin(foo)) //Prints: false
|
||||
print(isBuiltin(assert)) //Prints: true
|
||||
Loading…
Add table
Add a link
Reference in a new issue