start at the end and go back in an array - RESOLVED --

start at the end and go back in an array - RESOLVED --

Postby Silvio.Falconi » Sat May 28, 2022 11:13 am

I have an array and I make this operation from record 1 to 10087

AEval( aData, { |a| If( a[ nPos1 ] == numero .or. ;
a[ nPos2 ] == numero .or. ;
a[ nPos3 ] == numero .or. ;
a[ nPos4 ] == numero .or. ;
a[ nPos5 ] == numero , nCount++, nil ) } )

Now I wish start at the end and go back
basically I want go to bottom() and make to skip (-1) up to a certain record
How I can resolve ?
Last edited by Silvio.Falconi on Wed Jun 01, 2022 11:40 am, edited 1 time in total.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7034
Joined: Thu Oct 18, 2012 7:17 pm

Re: start at the end and go back in an array

Postby Otto » Sat May 28, 2022 1:35 pm

Silvio,
Just a question.
Why do you use AEVAL and not just FOR NEXT?
I think AEVAL is only for ARRAY professionals.
And it doesn't bring anything except shorter code that only occasional users don't understand right away.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6313
Joined: Fri Oct 07, 2005 7:07 pm

Re: start at the end and go back in an array

Postby Antonio Linares » Sat May 28, 2022 4:03 pm

Dear Silvio,

Same as we have a RAScan() we should have a RAEval(). It is not difficult to implement it and we can do it :-)
Unless there is a function AReverse() (also missing) that I am not aware of.

Dear Otto,

AEval(), AScan(), etc. are much faster than using for ... next loops as they don't use pcode for the loops.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42068
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: start at the end and go back in an array

Postby Antonio Linares » Sat May 28, 2022 6:19 pm

Dear Silvio,

Mr. Rao has already implemented RAEval() in a very simple way :-) To be included in the next FWH build

Code: Select all  Expand view
function FW_RAEval( aArray, bBlock, nStart, nCount )

   local nPos  := IfNil( nStart, Len( aArray ) )

   RAScan( aArray, { |u| Eval( bBlock, u, nPos ), nPos--, .f. }, nStart, nCount )

return aArray
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42068
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: start at the end and go back in an array

Postby Silvio.Falconi » Sat May 28, 2022 7:37 pm

Antonio Linares wrote:Dear Silvio,

Mr. Rao has already implemented RAEval() in a very simple way :-) To be included in the next FWH build

Code: Select all  Expand view
function FW_RAEval( aArray, bBlock, nStart, nCount )

   local nPos  := IfNil( nStart, Len( aArray ) )

   RAScan( aArray, { |u| Eval( bBlock, u, nPos ), nPos--, .f. }, nStart, nCount )

return aArray


Antonio,
I not Understood how I can make to converte my function and use an array instead dbf I explain you

My Function ( it it slows down enough)

Code: Select all  Expand view
Function Ritardo(numero,nrecord,nRuota)
        local oDbfRit,cond
        local r1,r2,r3,r4,r5
        local nritardo:=0
        local nOldArea := select()
        local cDir:=".\data\"

        do case
      case nRuota = 1
         r1:= "
BA1"
         r2:= "
BA2"
         r3:= "
BA3"
         r4:= "
BA4"
         r5:= "
BA5"
            case nRuota = 2
         r1:= "
CA1"
         r2:= "
CA2"
         r3:= "
CA3"
         r4:= "
CA4"
         r5:= "
CA5"
           case nRuota = 3
         r1:= "
FI1"
         r2:= "
FI2"
         r3:= "
FI3"
         r4:= "
FI4"
         r5:= "
FI5"
          case nRuota = 4
         r1:= "
GE1"
         r2:= "
GE2"
         r3:= "
GE3"
         r4:= "
GE4"
         r5:= "
GE5"
       case nRuota = 5
         r1:= "
MI1"
         r2:= "
MI2"
         r3:= "
MI3"
         r4:= "
MI4"
         r5:= "
MI5"
         case nRuota = 6
         r1:= "
NA1"
         r2:= "
NA2"
         r3:= "
NA3"
         r4:= "
NA4"
         r5:= "
NA5"
       case nRuota = 7
         r1:= "
PA1"
         r2:= "
PA2"
         r3:= "
PA3"
         r4:= "
PA4"
         r5:= "
PA5"
      case nRuota = 8
         r1:= "
RM1"
         r2:= "
RM2"
         r3:= "
RM3"
         r4:= "
RM4"
         r5:= "
RM5"
       case nRuota = 9
         r1:= "
TO1"
         r2:= "
TO2"
         r3:= "
TO3"
         r4:= "
TO4"
         r5:= "
TO5"
      case nRuota = 10
         r1:= "
VE1"
         r2:= "
VE2"
         r3:= "
VE3"
         r4:= "
VE4"
         r5:= "
VE5"
      case nRuota = 11
         r1:= "
NZ1"
         r2:= "
NZ2"
         r3:= "
NZ3"
         r4:= "
NZ4"
         r5:= "
NZ5"
      endcase

       oDbfRit:= TDatabase():Open( , cDir+"
lotto", "DBFCDX", .T. )
       oDbfRit:setorder(0)
       oDbfRit:goto(nRecord-1)


      Do while .not. oDbfRit:eof()

                cond:= oDbfRit:&r1  = numero .OR. ;
                       oDbfRit:&r2  = numero .OR. ;
                       oDbfRit:&r3  = numero .OR. ;
                       oDbfRit:&r4  = numero .OR. ;
                       oDbfRit:&r5  = numero
                If cond

                   exit
                else
                    nritardo:= nritardo + 1
                endif
                oDbfRit:skip(-1)

             enddo
             oDbfRit:close()
             select(nOldArea )
      return  nritardo
//-------------------------------------------------------------//



With array ( but this cycle always advances one record)

Function Delay(aData, numero, nWheel)
local nPos1,nPos2,nPos3,nPos4,nPos5

Do case
case nWheel = 1
nPos1:= 3
nPos2:= 4
nPos3:= 5
nPos4:= 6
nPos5:= 7
case nWheel = 2
nPos1:= 8
nPos2:= 9
nPos3:= 10
nPos4:= 11
nPos5:= 12
case nWheel = 3
nPos1:= 13
nPos2:= 14
nPos3:= 15
nPos4:= 16
nPos5:= 17
case nWheel = 4
nPos1:= 18
nPos2:= 19
nPos3:= 20
nPos4:= 21
nPos5:= 22
case nWheel = 5
nPos1:= 23
nPos2:= 24
nPos3:= 25
nPos4:= 26
nPos5:= 27
case nWheel = 6
nPos1:= 28
nPos2:= 29
nPos3:= 30
nPos4:= 31
nPos5:= 32

case nWheel = 7
nPos1:= 33
nPos2:= 34
nPos3:= 35
nPos4:= 36
nPos5:= 37
case nWheel = 8
nPos1:= 38
nPos2:= 39
nPos3:= 40
nPos4:= 41
nPos5:= 42
case nWheel = 9
nPos1:= 43
nPos2:= 44
nPos3:= 45
nPos4:= 46
nPos5:= 47
case nWheel = 10
nPos1:= 48
nPos2:= 49
nPos3:= 50
nPos4:= 51
nPos5:= 52
case nWheel = 11
nPos1:= 53
nPos2:= 54
nPos3:= 55
nPos4:= 56
nPos5:= 57
Endcase

but this cycle always advances one record
How I can to go back ? i.e. skip -1

AEval( aData, { |a| If( a[ nPos1 ] == numero .or. ;
a[ nPos2 ] == numero .or. ;
a[ nPos3 ] == numero .or. ;
a[ nPos4 ] == numero .or. ;
a[ nPos5 ] == numero , nCount++, nil ) } )

return nCount
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7034
Joined: Thu Oct 18, 2012 7:17 pm

Re: start at the end and go back in an array

Postby Otto » Sun May 29, 2022 5:21 pm

Dear Antonio,

RAScan( )
R - What does the abbreviation stand for?

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6313
Joined: Fri Oct 07, 2005 7:07 pm

Re: start at the end and go back in an array

Postby Detlef » Sun May 29, 2022 7:58 pm

I think it's for 'reverse'.
User avatar
Detlef
 
Posts: 207
Joined: Mon Feb 07, 2022 9:54 pm

Re: start at the end and go back in an array

Postby Antonio Linares » Sun May 29, 2022 8:20 pm

Yes, Detlef is correct. It stands for "reverse"

The same way, RAEval() would stand for reverse AEval()
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42068
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: start at the end and go back in an array

Postby Silvio.Falconi » Mon May 30, 2022 8:03 am

Antonio Linares wrote:Yes, Detlef is correct. It stands for "reverse"

The same way, RAEval() would stand for reverse AEval()


Antonio,
the function run bad or I not set right ...

I Insert also the old function Ritardo() made with dbf ( I send you the new lotto.dbf)

the number delay must be 24 as the result of old function Ritardo()

the new function Rit () made with fw_eval not run ok

the code
Code: Select all  Expand view
#include "fivewin.ch"

Function test()
local oDbf,aDatadbf
local number,nRecord
local nDelay
local cDir:=".\data\"

   oDbf:=TDatabase():Open( , cDir+"
lotto", "DBFCDX", .T. )
   oDbf:setorder(1)
   oDbf:gobottom()
   nrecord:=oDbf:recno() //for old function

   aDataDbf:=oDbf:DbfToArray()
   number:=oDbf:ba1

   //New with array
   nDelay:= Rit( aDataDbf, number, 1, nrecord )

   ?nDelay, "
New array function"

 // Old with dbf
   nDelay:= Ritardo(number,nrecord,1)

?nDelay,"
Old right function"

Return nil

Function Rit( aData, numero, nWheel, nstart )
   local nCount   := 0
   local nPos1,nPos2,nPos3,nPos4,nPos5

   Do case
     case  nWheel = 1
        nPos1:= 3
        nPos2:= 4
        nPos3:= 5
        nPos4:= 6
        nPos5:= 7
     case  nWheel = 2
        nPos1:= 8
        nPos2:= 9
        nPos3:= 10
        nPos4:= 11
        nPos5:= 12
    case  nWheel = 3
        nPos1:= 13
        nPos2:= 14
        nPos3:= 15
        nPos4:= 16
        nPos5:= 17
    case  nWheel = 4
        nPos1:= 18
        nPos2:= 19
        nPos3:= 20
        nPos4:= 21
        nPos5:= 22
     case  nWheel = 5
        nPos1:= 23
        nPos2:= 24
        nPos3:= 25
        nPos4:= 26
        nPos5:= 27
    case  nWheel = 6
        nPos1:= 28
        nPos2:= 29
        nPos3:= 30
        nPos4:= 31
        nPos5:= 32

    case  nWheel = 7
        nPos1:= 33
        nPos2:= 34
        nPos3:= 35
        nPos4:= 36
        nPos5:= 37
    case  nWheel = 8
        nPos1:= 38
        nPos2:= 39
        nPos3:= 40
        nPos4:= 41
        nPos5:= 42
      case  nWheel = 9
        nPos1:= 43
        nPos2:= 44
        nPos3:= 45
        nPos4:= 46
        nPos5:= 47
    case  nWheel = 10
        nPos1:= 48
        nPos2:= 49
        nPos3:= 50
        nPos4:= 51
        nPos5:= 52
     case  nWheel = 11
        nPos1:= 53
        nPos2:= 54
        nPos3:= 55
        nPos4:= 56
        nPos5:= 57
     Endcase

 array:=  FW_RAEval( aData, { |a| If( a[ nPos1 ]   == numero .or. ;
                           a[ nPos2 ] == numero .or. ;
                           a[ nPos3 ] == numero .or. ;
                           a[ nPos4 ] == numero .or. ;
                           a[ nPos5 ] == numero  , ,nCount++) }, nstart )

 xbrowser array
   return nCount





function FW_RAEval( aArray, bBlock, nStart, nCount )

   local nPos  := IfNil( nStart, Len( aArray ) )

   RAScan( aArray, { |u| Eval( bBlock, u, nPos ), nPos--, .f. }, nStart, nCount )

   return aArray



 //OLD FUNCTION
 Function Ritardo(numero,nrecord,nRuota)
        local oDbfRit,cond
        local r1,r2,r3,r4,r5
        local nritardo:=0
        local nOldArea := select()
        local cDir:="
.\data\"

        do case
      case nRuota = 1
         r1:= "
BA1"
         r2:= "
BA2"
         r3:= "
BA3"
         r4:= "
BA4"
         r5:= "
BA5"
            case nRuota = 2
         r1:= "
CA1"
         r2:= "
CA2"
         r3:= "
CA3"
         r4:= "
CA4"
         r5:= "
CA5"
           case nRuota = 3
         r1:= "
FI1"
         r2:= "
FI2"
         r3:= "
FI3"
         r4:= "
FI4"
         r5:= "
FI5"
          case nRuota = 4
         r1:= "
GE1"
         r2:= "
GE2"
         r3:= "
GE3"
         r4:= "
GE4"
         r5:= "
GE5"
       case nRuota = 5
         r1:= "
MI1"
         r2:= "
MI2"
         r3:= "
MI3"
         r4:= "
MI4"
         r5:= "
MI5"
         case nRuota = 6
         r1:= "
NA1"
         r2:= "
NA2"
         r3:= "
NA3"
         r4:= "
NA4"
         r5:= "
NA5"
       case nRuota = 7
         r1:= "
PA1"
         r2:= "
PA2"
         r3:= "
PA3"
         r4:= "
PA4"
         r5:= "
PA5"
      case nRuota = 8
         r1:= "
RM1"
         r2:= "
RM2"
         r3:= "
RM3"
         r4:= "
RM4"
         r5:= "
RM5"
       case nRuota = 9
         r1:= "
TO1"
         r2:= "
TO2"
         r3:= "
TO3"
         r4:= "
TO4"
         r5:= "
TO5"
      case nRuota = 10
         r1:= "
VE1"
         r2:= "
VE2"
         r3:= "
VE3"
         r4:= "
VE4"
         r5:= "
VE5"
      case nRuota = 11
         r1:= "
NZ1"
         r2:= "
NZ2"
         r3:= "
NZ3"
         r4:= "
NZ4"
         r5:= "
NZ5"
      endcase

       oDbfRit:= TDatabase():Open( , cDir+"
lotto", "DBFCDX", .T. )
       oDbfRit:setorder(0)
       oDbfRit:goto(nRecord-1)


      Do while .not. oDbfRit:eof()

                cond:= oDbfRit:&r1  = numero .OR. ;
                       oDbfRit:&r2  = numero .OR. ;
                       oDbfRit:&r3  = numero .OR. ;
                       oDbfRit:&r4  = numero .OR. ;
                       oDbfRit:&r5  = numero
                If cond

                   exit
                else
                    nritardo:= nritardo + 1
                 endif

                oDbfRit:skip(-1)

             enddo
             oDbfRit:close()
             select(nOldArea )
      return  nritardo
//-------------------------------------------------------------//







probable I not understood how run it ...
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7034
Joined: Thu Oct 18, 2012 7:17 pm

Re: start at the end and go back in an array

Postby Detlef » Mon May 30, 2022 2:30 pm

Hi Silvo,

I have no solution for your problem because for the moment I've not time enough to be occupied with your complex materials.
But to code more efficient I would replace
Do case
case nWheel = 1
nPos1:= 3
nPos2:= 4
nPos3:= 5
nPos4:= 6
nPos5:= 7
case nWheel = 2
nPos1:= 8
nPos2:= 9
nPos3:= 10
nPos4:= 11
nPos5:= 12
case nWheel = 3
nPos1:= 13
nPos2:= 14
nPos3:= 15
nPos4:= 16
nPos5:= 17
case nWheel = 4
nPos1:= 18
nPos2:= 19
nPos3:= 20
nPos4:= 21
nPos5:= 22
case nWheel = 5
nPos1:= 23
nPos2:= 24
nPos3:= 25
nPos4:= 26
nPos5:= 27
case nWheel = 6
nPos1:= 28
nPos2:= 29
nPos3:= 30
nPos4:= 31
nPos5:= 32

case nWheel = 7
nPos1:= 33
nPos2:= 34
nPos3:= 35
nPos4:= 36
nPos5:= 37
case nWheel = 8
nPos1:= 38
nPos2:= 39
nPos3:= 40
nPos4:= 41
nPos5:= 42
case nWheel = 9
nPos1:= 43
nPos2:= 44
nPos3:= 45
nPos4:= 46
nPos5:= 47
case nWheel = 10
nPos1:= 48
nPos2:= 49
nPos3:= 50
nPos4:= 51
nPos5:= 52
case nWheel = 11
nPos1:= 53
nPos2:= 54
nPos3:= 55
nPos4:= 56
nPos5:= 57
Endcase

with these 5 lines:
Code: Select all  Expand view
      nPos1 := ( nWheel - 1 ) * 5 + 3
      nPos2 := ( nWheel - 1 ) * 5 + 4
      nPos3 := ( nWheel - 1 ) * 5 + 5
      nPos4 := ( nWheel - 1 ) * 5 + 6
      nPos5 := ( nWheel - 1 ) * 5 + 7
 

Regards, Detlef
User avatar
Detlef
 
Posts: 207
Joined: Mon Feb 07, 2022 9:54 pm

Re: start at the end and go back in an array

Postby Silvio.Falconi » Mon May 30, 2022 2:40 pm

the frequency run ok

Code: Select all  Expand view


Function freq( aData, numero, nWheel )
   local nCount   := 0
   local nPos1,nPos2,nPos3,nPos4,nPos5

      nPos1 := ( nWheel - 1 ) * 5 + 3
      nPos2 := ( nWheel - 1 ) * 5 + 4
      nPos3 := ( nWheel - 1 ) * 5 + 5
      nPos4 := ( nWheel - 1 ) * 5 + 6
      nPos5 := ( nWheel - 1 ) * 5 + 7

   AEval( aData, { |a| If( a[ nPos1 ]   == numero .or. ;
                           a[ nPos2 ] == numero .or. ;
                           a[ nPos3 ] == numero .or. ;
                           a[ nPos4 ] == numero .or. ;
                           a[ nPos5 ] == numero  , nCount++, nil ) } )

   return nCount


 


the delay is the inverse from bottom skip -1 to where it found the number

With dbf the function is
Code: Select all  Expand view
Function Ritardo(numero,nrecord,nRuota)
        local oDbfRit,cond
        local r1,r2,r3,r4,r5
        local nritardo:=0
        local nOldArea := select()
        local cDir:=".\data\"

        do case
      case nRuota = 1
         r1:= "
BA1"
         r2:= "
BA2"
         r3:= "
BA3"
         r4:= "
BA4"
         r5:= "
BA5"
            case nRuota = 2
         r1:= "
CA1"
         r2:= "
CA2"
         r3:= "
CA3"
         r4:= "
CA4"
         r5:= "
CA5"
           case nRuota = 3
         r1:= "
FI1"
         r2:= "
FI2"
         r3:= "
FI3"
         r4:= "
FI4"
         r5:= "
FI5"
          case nRuota = 4
         r1:= "
GE1"
         r2:= "
GE2"
         r3:= "
GE3"
         r4:= "
GE4"
         r5:= "
GE5"
       case nRuota = 5
         r1:= "
MI1"
         r2:= "
MI2"
         r3:= "
MI3"
         r4:= "
MI4"
         r5:= "
MI5"
         case nRuota = 6
         r1:= "
NA1"
         r2:= "
NA2"
         r3:= "
NA3"
         r4:= "
NA4"
         r5:= "
NA5"
       case nRuota = 7
         r1:= "
PA1"
         r2:= "
PA2"
         r3:= "
PA3"
         r4:= "
PA4"
         r5:= "
PA5"
      case nRuota = 8
         r1:= "
RM1"
         r2:= "
RM2"
         r3:= "
RM3"
         r4:= "
RM4"
         r5:= "
RM5"
       case nRuota = 9
         r1:= "
TO1"
         r2:= "
TO2"
         r3:= "
TO3"
         r4:= "
TO4"
         r5:= "
TO5"
      case nRuota = 10
         r1:= "
VE1"
         r2:= "
VE2"
         r3:= "
VE3"
         r4:= "
VE4"
         r5:= "
VE5"
      case nRuota = 11
         r1:= "
NZ1"
         r2:= "
NZ2"
         r3:= "
NZ3"
         r4:= "
NZ4"
         r5:= "
NZ5"
      endcase

       oDbfRit:= TDatabase():Open( , cDir+"
lotto", "DBFCDX", .T. )
       oDbfRit:setorder(0)
       oDbfRit:goto(nRecord-1)


      Do while .not. oDbfRit:eof()

                cond:= oDbfRit:&r1  = numero .OR. ;
                       oDbfRit:&r2  = numero .OR. ;
                       oDbfRit:&r3  = numero .OR. ;
                       oDbfRit:&r4  = numero .OR. ;
                       oDbfRit:&r5  = numero
                If cond

                   exit
                else
                    nritardo:= nritardo + 1
                endif
                oDbfRit:skip(-1)

             enddo
             oDbfRit:close()
             select(nOldArea )
      return  nritardo
//-------------------------------------------------------------//




I wish create if with array because can be also more fast
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7034
Joined: Thu Oct 18, 2012 7:17 pm

Re: start at the end and go back in an array

Postby Otto » Mon May 30, 2022 3:03 pm

Why don't you post theARRAY or the database?
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6313
Joined: Fri Oct 07, 2005 7:07 pm

Re: start at the end and go back in an array

Postby Silvio.Falconi » Mon May 30, 2022 3:30 pm

I send you to another post the array of this year




Code: Select all  Expand view


function aData_array()
return ;
{  {"22 ",SToD("20220219"),23,36,68,10,49,29,28,21,50,7,27,30,20,25,62,3,81,22,90,13,14,22,31,61,62,14,71,46,21,74,82,59,90,79,83,82,15,87,75,51,82,76,74,68,24,77,6,7,26,55,15,71,77,36,43} ;
,  {"23 ",SToD("20220222"),35,83,47,74,62,43,44,42,71,31,88,36,32,28,45,14,11,21,24,76,7,52,64,57,24,6,71,35,53,23,77,21,55,47,65,55,89,19,76,75,81,60,63,44,31,10,72,80,63,39,21,66,28,48,45} ;
,  {"24 ",SToD("20220224"),46,74,32,68,79,82,25,51,79,44,75,65,63,66,43,61,2,75,65,24,64,12,60,56,34,57,64,84,53,42,41,21,17,76,68,36,33,54,14,38,3,87,29,13,15,67,11,53,89,71,80,27,63,86,11} ;
,  {"25 ",SToD("20220226"),87,47,69,31,79,56,32,20,21,19,56,84,15,13,37,24,5,69,39,21,89,36,54,55,12,58,40,72,78,14,63,39,9,32,15,28,46,11,68,29,24,85,42,19,67,13,89,72,88,56,31,33,54,21,47} ;
,  {"26 ",SToD("20220301"),61,68,49,75,71,24,54,52,71,79,54,72,60,46,75,89,69,53,74,76,88,30,22,48,1,5,17,88,44,60,78,2,51,5,8,72,67,24,34,82,49,30,51,11,87,14,31,60,25,21,62,1,16,43,12} ;
,  {"27 ",SToD("20220303"),11,57,56,66,60,17,5,4,14,81,48,72,74,59,39,26,90,57,70,59,18,33,52,28,38,59,50,18,9,12,47,29,16,55,73,75,90,85,45,82,1,2,68,79,16,52,48,46,37,81,35,45,20,44,31} ;
,  {"28 ",SToD("20220305"),89,26,36,1,68,20,39,40,11,41,65,15,30,78,62,83,48,81,56,28,6,76,32,12,26,16,32,69,14,38,71,63,87,54,12,36,49,71,81,76,35,6,70,42,59,18,46,41,76,33,22,75,54,76,14} ;
,  {"29 ",SToD("20220308"),8,62,44,12,79,33,29,28,74,64,30,24,2,55,36,71,28,34,64,60,40,20,82,85,57,6,69,54,70,24,36,42,68,21,10,36,77,88,42,27,81,6,2,16,25,82,39,17,51,43,15,9,37,69,54} ;
,  {"30 ",SToD("20220310"),73,53,45,37,87,24,69,19,84,73,61,80,45,29,40,27,28,42,87,49,2,88,6,4,75,29,4,50,33,83,14,30,77,72,42,3,48,68,39,43,23,7,77,84,89,90,84,78,56,41,16,40,22,83,62} ;
,  {"31 ",SToD("20220312"),7,17,77,76,86,86,22,19,65,40,55,63,14,80,33,17,35,85,9,7,52,18,12,47,1,11,49,21,72,55,21,2,81,50,61,27,53,77,57,49,62,87,76,24,35,90,65,56,74,31,71,51,20,79,77} ;
,  {"32 ",SToD("20220315"),49,27,37,45,57,23,34,31,78,52,18,62,1,75,23,6,28,76,41,75,48,3,13,14,67,74,23,51,37,35,89,59,60,58,67,40,42,24,65,10,38,12,59,65,64,41,29,32,10,26,2,31,11,14,58} ;
,  {"33 ",SToD("20220317"),10,17,28,19,87,75,26,52,22,20,66,7,45,59,17,85,4,41,36,78,61,55,9,56,49,41,68,10,27,54,83,49,7,31,10,56,66,40,23,47,35,79,49,51,66,48,1,37,16,86,49,79,22,3,30} ;
,  {"34 ",SToD("20220319"),48,35,64,14,38,90,73,42,66,46,6,51,68,41,64,63,13,25,75,65,67,2,38,18,40,25,64,66,82,7,10,69,43,51,62,74,55,29,28,45,78,3,70,50,55,46,41,64,57,70,45,70,54,35,85} ;
,  {"35 ",SToD("20220322"),22,30,16,88,29,11,21,73,67,59,69,82,44,59,1,27,74,84,45,58,65,77,40,64,30,15,75,59,2,88,89,74,59,56,88,57,36,73,56,72,39,61,78,70,27,7,57,79,52,82,51,79,55,7,41} ;
,  {"36 ",SToD("20220324"),53,45,61,17,56,39,31,72,17,73,73,56,9,37,82,62,35,39,29,3,48,33,9,69,65,26,58,57,30,37,12,85,40,31,67,89,24,79,82,59,44,2,49,74,63,46,76,82,10,23,10,50,6,25,27} ;
,  {"37 ",SToD("20220326"),28,61,20,37,39,52,65,75,35,46,61,34,15,48,67,64,43,7,75,55,61,5,69,40,76,61,49,83,36,67,83,29,74,30,90,7,6,14,23,32,29,84,1,5,20,64,85,22,65,90,28,51,46,27,38} ;
,  {"38 ",SToD("20220329"),54,89,4,57,88,17,2,12,67,31,49,24,52,19,51,61,58,3,1,63,29,56,73,82,11,17,49,31,44,88,83,21,55,29,23,23,42,14,71,87,17,19,81,13,36,41,90,10,74,45,29,18,7,72,61} ;
,  {"39 ",SToD("20220331"),41,29,58,24,50,67,36,21,47,87,63,45,53,58,69,68,80,31,56,87,28,87,10,3,70,71,35,62,36,28,29,87,34,85,25,62,84,11,45,76,3,16,53,72,5,11,75,35,54,73,6,15,80,77,64} ;
,  {"40 ",SToD("20220402"),35,41,38,6,73,11,49,84,54,80,54,1,27,16,57,4,66,74,85,31,35,24,85,80,39,65,62,64,84,74,72,19,47,26,62,29,79,18,75,77,79,42,1,56,32,44,7,5,68,54,54,62,77,85,88} ;
,  {"41 ",SToD("20220405"),28,48,17,46,7,14,78,86,76,21,15,33,4,53,75,44,10,11,65,48,18,52,21,27,51,35,11,42,15,51,62,87,8,68,19,31,5,77,76,60,79,54,6,78,81,10,13,70,44,85,15,19,14,2,24} ;
,  {"42 ",SToD("20220407"),85,29,78,75,87,58,81,80,78,16,20,31,33,46,12,54,79,32,77,40,64,23,61,90,77,84,22,69,54,37,58,17,87,76,70,4,25,66,27,19,90,26,69,65,72,33,43,11,89,79,60,13,71,61,35} ;
,  {"43 ",SToD("20220409"),25,34,68,90,66,54,31,35,17,53,45,44,5,23,34,42,13,89,20,8,54,76,60,48,22,85,15,34,66,68,82,22,83,12,4,41,73,46,15,72,25,10,89,71,65,58,80,59,35,1,33,56,87,30,84} ;
,  {"44 ",SToD("20220412"),61,44,50,41,30,68,4,47,25,78,1,35,2,53,69,90,73,71,82,81,39,21,72,47,38,58,16,86,25,39,5,33,27,53,54,18,20,69,25,78,25,50,41,69,36,10,43,40,82,88,27,17,66,60,34} ;
,  {"45 ",SToD("20220414"),54,72,12,85,58,83,61,41,53,55,87,48,54,49,64,25,42,75,62,43,6,64,8,61,26,71,70,50,54,17,12,41,54,72,80,89,32,80,8,75,22,49,41,5,64,78,8,56,74,14,50,54,56,78,30} ;
,  {"46 ",SToD("20220416"),47,90,39,40,81,16,81,58,67,71,72,30,8,3,88,2,18,15,26,90,3,89,37,2,21,30,14,62,76,2,29,60,14,64,85,5,1,19,18,87,81,61,52,76,31,16,81,87,19,2,18,83,89,75,68} ;
,  {"47 ",SToD("20220419"),36,56,61,73,86,22,85,54,87,26,54,88,61,3,38,23,19,78,15,53,53,20,31,58,65,45,68,18,32,74,76,4,52,30,1,58,51,49,15,2,12,7,22,17,39,27,18,25,66,33,61,81,62,55,26} ;
,  {"48 ",SToD("20220421"),37,14,7,62,49,46,28,76,81,85,51,75,32,21,19,23,11,27,80,67,46,35,23,9,69,83,27,82,2,39,56,38,87,83,29,83,77,44,23,65,44,19,8,62,22,8,84,32,53,35,35,79,27,90,70} ;
,  {"49 ",SToD("20220423"),82,90,20,9,28,47,66,48,68,39,53,17,34,41,22,20,76,53,78,33,30,10,5,75,69,45,54,7,16,83,23,86,24,72,70,85,31,54,10,65,59,19,17,67,38,81,77,34,62,90,1,58,78,4,55} ;
,  {"50 ",SToD("20220426"),58,88,86,50,53,55,13,46,41,11,1,9,52,47,45,7,82,29,70,78,90,40,64,1,31,74,82,33,52,36,54,3,50,32,28,51,3,38,70,32,61,17,52,24,47,86,2,42,59,4,78,87,73,86,9} ;
,  {"51 ",SToD("20220428"),10,85,30,17,50,40,13,14,85,87,68,58,1,53,89,2,17,33,22,20,27,37,38,55,54,51,75,20,78,37,26,59,85,89,88,53,9,84,54,25,41,50,53,22,21,31,24,16,4,27,7,73,5,16,68} ;
,  {"52 ",SToD("20220430"),47,15,76,12,90,42,53,2,20,79,78,75,24,85,67,9,2,37,17,86,65,87,25,81,39,65,85,62,35,66,64,28,55,18,76,5,49,25,24,74,73,16,82,78,80,64,51,11,21,86,25,17,14,70,86} ;
,  {"53 ",SToD("20220503"),80,69,84,73,50,72,62,67,82,9,66,17,7,38,46,37,64,90,88,67,80,72,1,63,18,46,18,83,34,25,35,34,9,76,51,90,54,76,80,71,12,43,22,71,5,38,5,35,66,6,8,12,54,63,80} ;
,  {"54 ",SToD("20220505"),67,48,16,42,87,73,66,61,6,88,39,30,4,78,38,33,67,12,78,6,11,47,37,16,81,32,4,51,25,38,37,16,80,86,8,5,45,21,47,76,27,15,6,25,71,71,86,22,60,50,36,8,24,29,20} ;
,  {"55 ",SToD("20220507"),34,82,52,53,45,74,39,62,12,86,29,14,42,89,52,25,46,90,82,65,57,72,38,29,86,75,63,13,48,69,1,31,15,68,52,31,51,7,90,52,54,28,23,80,31,21,57,54,83,38,28,26,30,55,64} ;
,  {"56 ",SToD("20220510"),49,77,90,85,14,43,55,80,37,22,74,41,89,65,11,76,58,72,49,85,50,33,36,19,74,26,16,47,73,21,67,69,16,37,20,79,72,30,10,58,59,56,55,47,40,69,78,70,30,8,41,45,44,37,18} ;
,  {"57 ",SToD("20220512"),51,26,88,69,60,22,43,14,38,60,25,41,60,57,42,17,3,32,53,63,62,46,3,61,84,22,42,24,52,90,60,41,33,78,18,80,8,25,37,53,4,49,46,38,28,42,9,45,44,79,89,30,58,52,90} ;
,  {"58 ",SToD("20220514"),47,44,62,8,86,64,84,44,20,88,71,63,73,66,59,48,50,5,46,2,49,13,4,69,62,64,11,21,19,48,22,81,31,55,53,9,40,56,33,70,48,41,8,26,85,87,77,19,5,14,73,52,58,66,90} ;
,  {"59 ",SToD("20220517"),16,31,30,50,81,14,4,24,61,87,38,5,28,33,39,80,22,58,35,88,23,72,9,5,1,85,71,82,1,39,50,23,78,39,35,74,83,32,90,1,51,8,59,25,23,21,83,28,62,4,51,31,67,54,62} ;
,  {"60 ",SToD("20220519"),32,21,59,44,90,10,25,53,67,17,7,57,11,1,60,29,51,41,56,48,86,41,37,30,26,33,54,78,41,19,23,13,6,81,56,4,14,61,17,47,3,42,34,69,59,89,13,38,74,65,53,35,85,72,82} ;
,  {"61 ",SToD("20220521"),42,28,73,64,30,48,20,7,34,67,36,27,79,50,87,78,19,87,39,27,84,7,83,66,9,88,8,61,42,26,76,70,56,25,65,66,7,88,1,24,33,21,49,47,22,88,11,65,69,37,38,31,27,22,14} ;
,  {"62 ",SToD("20220524"),81,36,72,84,40,8,80,43,67,64,20,90,58,80,51,40,53,80,62,41,74,62,22,63,35,54,77,76,78,21,50,56,72,42,64,9,88,85,65,6,86,59,21,55,54,77,63,8,10,58,45,79,87,84,72} ;
,  {"63 ",SToD("20220526"),89,58,55,31,67,1,88,79,80,59,47,4,41,62,65,67,7,5,46,44,57,43,64,58,17,56,79,14,37,90,53,37,39,24,86,32,7,18,57,44,64,44,31,70,20,86,67,64,58,22,17,47,77,1,6} ;
}
 



Perhaph is wrong the codeblock bBlock

Function test()
local aDatadbf:=aData_array()
local number,nRecord
local nDelay

number:=89 // delay must be 24

? Rit( aDataDbf, number, 1, nrecord )
return nil

Function Rit( aData, numero, nWheel,nRecord )
local nCount := 0
local nPos1,nPos2,nPos3,nPos4,nPos5
local bBlock

nPos1 := ( nWheel - 1 ) * 5 + 3
nPos2 := ( nWheel - 1 ) * 5 + 4
nPos3 := ( nWheel - 1 ) * 5 + 5
nPos4 := ( nWheel - 1 ) * 5 + 6
nPos5 := ( nWheel - 1 ) * 5 + 7

bBlock:= { |a| If( a[ nPos1 ] = numero .or. ;
a[ nPos2 ] = numero .or. ;
a[ nPos3 ] = numero .or. ;
a[ nPos4 ] = numero .or. ;
a[ nPos5 ] = numero , , nCount++ ) }



FW_RAEval( aData, bBlock, nRecord-1 )



return nCount
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7034
Joined: Thu Oct 18, 2012 7:17 pm

Re: start at the end and go back in an array

Postby Otto » Mon May 30, 2022 4:42 pm

Dear Antonio,
I do not understand the return value.

Best regards,
Otto

Code: Select all  Expand view


function FW_RAEval( aArray, bBlock, nStart, nCount )

   local nPos  := IfNil( nStart, Len( aArray ) )

   RAScan( aArray, { |u| Eval( bBlock, u, nPos ), nPos--, .f. }, nStart, nCount )

return aArray
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6313
Joined: Fri Oct 07, 2005 7:07 pm

Re: start at the end and go back in an array

Postby Silvio.Falconi » Mon May 30, 2022 5:04 pm

also I ++
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7034
Joined: Thu Oct 18, 2012 7:17 pm

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 103 guests