# GET-BLOCK!, GET, and REDUCE

**URL:** <https://revolt.metaeducation.com/forum/t/get-block-get-and-reduce/1183>\
**Category:** Datatypes\
**Created:** [July 22, 2019, 2:26pm UTC](https://revolt.metaeducation.com/forum/t/get-block-get-and-reduce/1183 "2019-07-22T14:26:34Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![hostilefork](https://revolt.metaeducation.com/forum/user_avatar/revolt.metaeducation.com/hostilefork/32/421_2.png) [@hostilefork](https://revolt.metaeducation.com/forum/u/hostilefork)\
**Post date:** [July 31, 2021, 8:44pm UTC](https://revolt.metaeducation.com/forum/t/get-block-get-and-reduce/1183/6 "2021-07-31T20:44:55Z")

</div>

## I have restored the behavior that GET-BLOCK! acts as REDUCE

```
>> :[1 + 2 10 + 20]
== [3 30]

```

This means that if you're dealing with a literal block, you can avoid functions like REPEND.

```
>> append [a b c] :[1 + 2 10 + 20]
== [a b c 3 30]

```

And I think it means we can be happy enough defining JOIN as not reducing by default:

```
>> data: [a b c]

>> join data [1 + 2 10 + 20]
== [a b c 1 + 2 10 + 20]

>> data
== [a b c]

```

If you want to reduce, you ask for it:

```
>> data: [a b c]

>> join data :[1 + 2 10 + 20]
== [a b c 3 30]

>> data
== [a b c]

```

_This case of literal information actually comes up rather often._ For those who prefer writing out the word REDUCE even in literal cases, no problem.

## What about SET and GET natives and BLOCK?!

The thing I had been fretting about was if SET of BLOCK! and a GET of BLOCK! didn't do the same thing as a SET-BLOCK! and GET-BLOCK! would.

Yet today know that SET-BLOCK! has the behavior of multi-return, and that's been a huge win. It's not possible to unify that behavior for what it means to combine the SET native and a BLOCK! value.

And as I've mentioned, historical Rebol2 and Red do not have meaning for a GET of a BLOCK!, it's an error:

```
red>> a: 10
red>> b: 20
red>> get [a b]
*** Script Error: get does not allow block! for its word argument

```

So it's not **[10 20]** as one might expect (though you might argue it's just an oversight and they'll add it some day).

But I don't like these operations and I've explained why: _not all variable states can be put into block elements_. You can't put NULL and you can't put BAD-WORD! isotopes.

**[The workaround I came up with is called UNPACK](https://revolt.metaeducation.com/forum/t/a-lot-to-unpack-replacing-the-set-of-reduce-block-idiom/1634)** and I think it really sorts out the various problems that GET and SET of BLOCK!s invariably introduce.

---

_[View the full topic](https://revolt.metaeducation.com/forum/t/get-block-get-and-reduce/1183)._
