Data update

This commit is contained in:
Ingy döt Net 2024-11-11 10:11:44 -08:00
parent 157b70a810
commit 8e4e15fa56
78 changed files with 2016 additions and 222 deletions

View file

@ -1,4 +1,30 @@
module Anonymus_lambda {
Print lambda (x as long long)->{=If(x>1->lambda(x-1)+lambda(x-2), x)}(10)=55
Module Anonymus_lambda (x, result){
global Err = lambda (x) ->{
if x=1 then Error "Negative input"
}
' in one line - so Error have to call it through a global function
Print lambda (x as long long)->{=if(x<0->Err(1), lambda (x)->{=If(x>1->lambda(x-1)+lambda(x-2), x)}(x))}(x)=result
}
Anonymus_Lambda
Anonymus_Lambda 10, 55
Anonymus_Lambda 7, 13
Try Ok {
Anonymus_Lambda -7, 13 ' return false, and also we have error
' so here we exit from block - no printing "nothing"
Print "nothing"
}
If error or not ok then Report Error$
Module Anonymus_lambda (x, result){
' Using multiple lines for the Lambda - so Error can be used here
Print lambda (x as long long)->{
if x<0 then Error "Negative input"
=lambda (x)->{=If(x>1->lambda(x-1)+lambda(x-2), x)}(x)
}(x)=result
}
Anonymus_Lambda 10, 55
Anonymus_Lambda 7, 13
Try Ok {
Anonymus_Lambda -7, 13 ' nothing return we have error
' so here we exit from block - no printing "nothing"
Print "nothing"
}
If error or not ok then Report Error$