Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -4,7 +4,7 @@ Module LikeGroovy {
|
|||
partsof120=Curry(divide, 120)
|
||||
Print "half of 120 is ";partsof120(2)
|
||||
Print "a third is ";partsof120(3)
|
||||
Print "and a quarter is ";partsof120(4)
|
||||
Print "and a quarter is ";partsof120(4)
|
||||
|
||||
joinTwoWordsWithSymbol=lambda (s, a, b)->a+s+b
|
||||
Assert joinTwoWordsWithSymbol("#","Hello", "World")="Hello#World"
|
||||
|
|
@ -16,44 +16,44 @@ Module LikeGroovy {
|
|||
}
|
||||
LikeGroovy
|
||||
Module M2000way {
|
||||
class curry{
|
||||
private:
|
||||
p=stack ' stack of values
|
||||
func$ ' field for the weak reference
|
||||
public:
|
||||
property counter {value } ' readonly
|
||||
class:
|
||||
module curry(.func$) {
|
||||
.p<=[]
|
||||
class value {
|
||||
value () {
|
||||
' symbol ! used for feeding stack of values from arrays or stacks.
|
||||
' [] is the current stack (leave emtpy stack as current stack)
|
||||
' Stack(.p) make a copy of .p (which have a stack object)
|
||||
=function(.func$, !stack(.p), ![])
|
||||
.[counter]++
|
||||
}
|
||||
}
|
||||
this=value() ' make this as a property
|
||||
}
|
||||
}
|
||||
' using a general function
|
||||
Function Divide(a, b) {
|
||||
=a/b
|
||||
}
|
||||
Print "Divide(10, 6) is ";Divide(10, 5)
|
||||
partsof120=Curry(&Divide(), 120)
|
||||
Print "half of 120 is ";partsof120(2)
|
||||
Print "a third is ";partsof120(3)
|
||||
Print "and a quarter is ";partsof120(4)
|
||||
Print "Use of partsof120 so far: "; partsof120.counter; " times"
|
||||
' using a lambda function
|
||||
joinTwoWordsWithSymbol=lambda (s, a, b)->a+s+b
|
||||
Assert joinTwoWordsWithSymbol("#","Hello", "World")="Hello#World"
|
||||
concatWords =Curry(&joinTwoWordsWithSymbol, " ")
|
||||
Assert concatWords("Hello", "World")="Hello World"
|
||||
prependHello =Curry(&concatWords, "Hello")
|
||||
Assert prependHello("World")="Hello World"
|
||||
Print "done"
|
||||
class curry{
|
||||
private:
|
||||
p=stack ' stack of values
|
||||
func$ ' field for the weak reference
|
||||
public:
|
||||
property counter {value } ' readonly
|
||||
class:
|
||||
module curry(.func$) {
|
||||
.p<=[]
|
||||
class value {
|
||||
value () {
|
||||
' symbol ! used for feeding stack of values from arrays or stacks.
|
||||
' [] is the current stack (leave emtpy stack as current stack)
|
||||
' Stack(.p) make a copy of .p (which have a stack object)
|
||||
=function(.func$, !stack(.p), ![])
|
||||
.[counter]++
|
||||
}
|
||||
}
|
||||
this=value() ' make this as a property
|
||||
}
|
||||
}
|
||||
' using a general function
|
||||
Function Divide(a, b) {
|
||||
=a/b
|
||||
}
|
||||
Print "Divide(10, 6) is ";Divide(10, 5)
|
||||
partsof120=Curry(&Divide(), 120)
|
||||
Print "half of 120 is ";partsof120(2)
|
||||
Print "a third is ";partsof120(3)
|
||||
Print "and a quarter is ";partsof120(4)
|
||||
Print "Use of partsof120 so far: "; partsof120.counter; " times"
|
||||
' using a lambda function
|
||||
joinTwoWordsWithSymbol=lambda (s, a, b)->a+s+b
|
||||
Assert joinTwoWordsWithSymbol("#","Hello", "World")="Hello#World"
|
||||
concatWords =Curry(&joinTwoWordsWithSymbol, " ")
|
||||
Assert concatWords("Hello", "World")="Hello World"
|
||||
prependHello =Curry(&concatWords, "Hello")
|
||||
Assert prependHello("World")="Hello World"
|
||||
Print "done"
|
||||
}
|
||||
M2000way
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue