# ListReduceRight

Run the provided udf over a reversed delimited list to reduce the values to a single output

## Method Signature

```
ListReduceRight(list=[string], callback=[function:BiFunction], initialValue=[any], delimiter=[string], includeEmptyFields=[boolean], multiCharacterDelimiter=[boolean])
```

### Arguments

| Argument                  | Type                  | Required | Description                                                                                                                                                                                            | Default |
| ------------------------- | --------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------- |
| `list`                    | `string`              | `true`   | The delimited list to perform operations on                                                                                                                                                            |         |
| `callback`                | `function:BiFunction` | `true`   | The function to invoke for each item. The function will be passed 3 arguments: the value, the index, the array. You can alternatively pass a Java BiFunction which will only receive the first 2 args. |         |
| `initialValue`            | `any`                 | `false`  | The initial value of the reduction                                                                                                                                                                     |         |
| `delimiter`               | `string`              | `false`  | string the list delimiter                                                                                                                                                                              | `,`     |
| `includeEmptyFields`      | `boolean`             | `false`  | boolean whether to include empty fields in the returned result                                                                                                                                         | `false` |
| `multiCharacterDelimiter` | `boolean`             | `false`  | boolean whether the delimiter is multi-character                                                                                                                                                       | `false` |

## Examples

### Simple listReduceRight Example

Demonstrate how the function works from right to left.

[Run Example](https://try.boxlang.io/?code=eJw1jUEKwjAQRdfmFJ8sJIW5Qajg3lVvUJtBAyaUMbUt0rt3SHX1H58HL623%2BC5oYXu600DBepN5%2Fp0vnY7DNHAXH8%2FikKpOcLjmFaPwhyplXspBMSwH9CJo0F7wNSfhMkmuPs5V1lHTm41gLRpvZolFS2l0%2BPf13QHc5DHQ)

```java
myList = "a,b,c,d";
newList = listReduceRight( myList, ( Any prev, Any next, Any idx, Any arr ) => {
	return prev & next & idx;
}, "" );
writedump( newList );

```

Result: d4c3b2a1

### listReduceRight as a Member Function

Demonstrate the member function.

[Run Example](https://try.boxlang.io/?code=eJw1jU0KwjAQhdfmFI8sJIXgBUIF9656g9oMGjChjNM%2FxLs7pLqZ%2BXjvg5e3a3oJWtje3%2Fzgow2m0PILc21PTz0dxWmgLt0f4uBwKRtGptlXKrTKTimuO%2FTMaNCe8TYHJpm4VB%2FHKutTM5iPh7Voglk4iS7k0eE%2Fr%2BkXv84xsg%3D%3D)

```java
myList = "a,b,c,d";
newList = myList.listReduceRight( ( Any prev, Any next, Any idx, Any arr ) => {
	return prev & next & idx;
}, "" );
writedump( newList );

```

Result: d4c3b2a1

### Empty Elements

Demonstrate the behavior when there is an empty element.

[Run Example](https://try.boxlang.io/?code=eJzLrfTJLC5RsFVQStQBgSQgTgbiFCVrrrzUcqhkLliVXg6QCEpNKU1ODcpMzyjRUNBQcMyrVCgoSi3TAbPyUitKIKzMlAoFTQVbO4VqLs6i1JLSojywMgU1sBogBVRgzVWro6CkpKBpzVVelFkCNDi3QEMBZitQFADheTA5)

```java
myList = "a,,,,,b,,,c,,,d";
newList = myList.listReduceRight( ( Any prev, Any next, Any idx ) => {
	return prev & next & idx;
}, "" );
writedump( newList );

```

Result: d4c3b2a1

## Related

* [GetToken](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/gettoken)
* [ListAppend](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listappend)
* [ListAvg](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listavg)
* [ListChangeDelims](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listchangedelims)
* [ListCompact](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listcompact)
* [ListContains](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listcontains)
* [ListContainsNoCase](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listcontainsnocase)
* [ListDeleteAt](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listdeleteat)
* [ListEach](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listeach)
* [ListEvery](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listevery)
* [ListFilter](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listfilter)
* [ListFind](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listfind)
* [ListFindNoCase](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listfindnocase)
* [ListFirst](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listfirst)
* [ListGetAt](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listgetat)
* [ListGetEndings](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listgetendings)
* [ListIndexExists](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listindexexists)
* [ListInsertAt](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listinsertat)
* [ListItemTrim](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listitemtrim)
* [ListLast](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listlast)
* [ListLen](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listlen)
* [ListMap](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listmap)
* [ListNone](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listnone)
* [ListPrepend](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listprepend)
* [ListQualify](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listqualify)
* [ListRemoveDuplicates](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listremoveduplicates)
* [ListRest](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listrest)
* [ListSetAt](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listsetat)
* [ListSome](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listsome)
* [ListSort](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listsort)
* [ListToArray](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listtoarray)
* [ListTrim](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listtrim)
* [ListValueCount](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listvaluecount)
* [ListValueCountNoCase](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listvaluecountnocase)
