New function ADiff( aArray1, aArray2 )
Posted:
Wed Feb 14, 2024 7:46 am
by Antonio Linares
Included in next FWH build:
- Code: Select all Expand view
function ADiff( a, b )
local c := {}
AEval( a, { | u, n | If( n > Len( b ), AAdd( c, u ),;
If( ValType( u ) != ValType( b[ n ] ), AAdd( c, u ),;
If( ! u == b[ n ], AAdd( c, u ),;
If( ValType( u ) == "A" .and. ValType( b[ n ] ) == "A", AAdd( c, ADiff( u, b[ n ] ) ), ) ) ) ) } )
AEval( b, { | u, n | If( n > Len( a ), AAdd( c, u ),) } )
return c
Re: New function ADiff( aArray1, aArray2 )
Posted:
Thu Feb 15, 2024 1:02 pm
by Silvio.Falconi
Antonio Linares wrote:Included in next FWH build:
- Code: Select all Expand view
function ADiff( a, b )
local c := {}
AEval( a, { | u, n | If( n > Len( b ), AAdd( c, u ),;
If( ValType( u ) != ValType( b[ n ] ), AAdd( c, u ),;
If( ! u == b[ n ], AAdd( c, u ),;
If( ValType( u ) == "A" .and. ValType( b[ n ] ) == "A", AAdd( c, ADiff( u, b[ n ] ) ), ) ) ) ) } )
AEval( b, { | u, n | If( n > Len( a ), AAdd( c, u ),) } )
return c
Can we have an example of use?
Re: New function ADiff( aArray1, aArray2 )
Posted:
Thu Feb 15, 2024 4:59 pm
by paquitohm
Fw_ValToExp_Mia(a) --> (C) Len: 37 "{'uno',{'hola','adios'},'dos','tres'}"
Fw_ValToExp_Mia(b) --> (C) Len: 45 "{'uno','cuatro',{'hola','adios'},'cinco',123}"
Fw_ValToExp_Mia(c) --> (C) Len: 35 "{{'hola','adios'},'dos','tres',123}"
Según se ve en el resultado, devuelve los valores de a que no existen en la misma posición de b, pudiendo ser los valores de cualquier tipo. Una posible variante sería que los valores pudieran estar en cualquier posición de b
Re: New function ADiff( aArray1, aArray2 )
Posted:
Thu Feb 15, 2024 6:10 pm
by nageswaragunupudi
FWH provides the function FW_ValToExp( uVal )
Where is the function Fw_ValToExp_Mia() from?
In what way it is different from the original FW_ValtoExp() function?