bug-guile
[Top][All Lists]

## Values extension

 From: Hans Aberg Subject: Values extension Date: Fri, 21 Jan 2011 18:13:26 +0100

```On 20 Jan 2011, at 22:18, Ludovic Courtès wrote:

```
```It is discussed here, along with some other ideas.

```
```
```
```
It is possible to extend Scheme values as to infix tuples usage:

```
Think of Scheme (f x_1 ... x_k) as equivalent to f(x_1 ... x_k), and add the reduction of tuples singletons (x) = x. Then (f (values x_1 ... x_k)) is the same as f((x_1 ... x_k)) = f(x_1 ... x_k), that is (f x_1 ... x_k). However, if more than one of the x_i in is a non- singleton, it is an iterated tuple which cannot be reduced on its topmost level.
```
```
In addition, I extended so that if f = (f_1, ..., f_n), then f(x) is defined to (f_1(x), ..., f_n(x)). For values, ((values f_1 ... f_n) x_1 ... x_k) computes to (values (f_1 x_1 ... x_k) ... (f_n x_1 ... x_k)). With this syntax, one can write (atan ((values sin cos) x)).
```
```
Also, functions that return no value might just as well return (values) instead of an internal unspecified value. It will then be as in C/C++.
```
This syntax is not at all complicated to use.

```