Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
20
Task/Catamorphism/PureBasic/catamorphism.basic
Normal file
20
Task/Catamorphism/PureBasic/catamorphism.basic
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
Procedure.i reduce(List l(),op$="+")
|
||||
If FirstElement(l())
|
||||
x=l()
|
||||
While NextElement(l())
|
||||
Select op$
|
||||
Case "+" : x+l()
|
||||
Case "-" : x-l()
|
||||
Case "*" : x*l()
|
||||
EndSelect
|
||||
Wend
|
||||
EndIf
|
||||
ProcedureReturn x
|
||||
EndProcedure
|
||||
|
||||
NewList fold()
|
||||
For i=1 To 5 : AddElement(fold()) : fold()=i : Next
|
||||
|
||||
Debug reduce(fold())
|
||||
Debug reduce(fold(),"-")
|
||||
Debug reduce(fold(),"*")
|
||||
Loading…
Add table
Add a link
Reference in a new issue