0 Members and 1 Guest are viewing this topic.
sub(ADD,5,5)If A = 10 Disp "Lol"EndLbl ADD r2 + r1 -> AReturn
If sub(ADD,5,5) = 10 Disp "Lol"EndLbl ADD r2 + r1Return
Lbl PRC:r1+3:ReturnIf sub(PRC,rand^4 -> A) = 6 Disp "'tis 6"Else Disp "No, it's actually",sub(PRC,A) >DecEnd
If sub(PCV,ºA) = 5 Disp "THIS IS 5."EndLbl PCV .The proc for attaching {r1}r + 5 -> {r1}rReturn
If sub(CA) = 5 Disp "THIS IS 5."EndLbl CA .Call A sub(PCV,ºA)ReturnLbl PCV {r1}r + 5 -> {r1}rReturn
If sub(CA) = 5 Disp "THIS IS 5."EndLbl CA {ºA}r + 5 -> {ºA}rReturn
Data(5,6,2,1,0) -> Str1sub(MAP,Str1)Lbl MAP For(A,0,length(r1)) {r1+A} + 5 -> {r1+A} EndReturn
Data(5,6,2,1) -> Str1sub(MAP,Str1,4)Lbl MAP For(A,0,r2) {r1+A} + 5 -> {r1+A} EndReturn
Data(1,2,3,0) -> Str1L1 -> P . Pointer to result arraysub(FLD,Str1,P)Lbl FLD For(A,0,length(r1)) {r1+A} + 5 -> {r2+A} EndReturn
Data(1,2,3,0) -> Str1L1 -> P . Pointer to output arraysub(FLD,Str1,P)Lbl FLD For(A,0,length(r1)) {r1+A} + 5 -> {r1+A} If {r1+A} = 10 1 -> {r2 + A} Else 0 -> {r2 + A} End EndReturn
Data(1,2,2,1,1,3,0) -> Str1L1 -> Psub(FLT,Str1,P)Lbl FLT 0 -> B For(A,0,length(r1)) If A*({r1+A}=1} -> {r2+B} B++ End EndReturn
Data(1,2,2,1,1,3,0) -> Str1L1 -> PDisp "Size of array: ",sub(FLT,Str1,A) >DecLbl FLT 0 -> B For(A,0,length(r1)) If A*({r1+A}=1} -> {r2+B} B++ End End BReturn
Data(1,2,1,2,3,1) -> Str1sub(MRF,Str1) -> PDisp {P+2} >Dec," Passing elements found, which are at indices: ",iFor(A,0,{P}r) Disp {{P}r+A} >Dec,", "EndLbl MRF ... CALL MALLOC COMMAND AND DELEGATE SOME MEMORY AND GIVE A POINTER IN P ... 0 -> B For(A,0,length(r1)) If A*({r1+A}=1} -> {P+B} B++ End End ... CALL MALLOC COMMAND AND DELEGATE SPACE THAT IS B BYTES LONG, POINTED TO BY Q ... P -> {Q}r . Load P into first two bytes B -> {Q+2} . Load length int 3rd byte Q . Return pointer to return arrayReturn
Guide to using Axe to its full functional form
Mapping and folding in Functional programming basically are functions that apply to all members of an Array, List, etc. Basically, they loop and fix all numbers one by one until the end of array or the specified length has been reached. An example: