biwascheme/biwascheme — Issue #8: Some functions are incorrectly converting nested lists
Author: kenpratt
Created: 2011-12-09 22:59:18+00:00
State: open

The following code:

```(map (lambda (x) x) (list 1 2 (vector 3 4)))```

Should return:

```(1 2 [3 4])``` (leaving the vector alone)

But is instead returning:

```(1 2 (3 4))``` (converting the vector into a list)

This is actually a deep problem in the codebase, caused by my refactoring in August:
https://github.com/kenpratt/biwascheme/commit/6367a19c40acc4b2541f02193d04fe0334317bb0
https://github.com/kenpratt/biwascheme/commit/6c4348871c0d87c3acbf6f48d4a6db607438ee7b

Basically, there used to be a function named ```build_list``` that did a deep conversion, and everything else was shallow, but in the process of refactoring I changed ```List(...)``` to be deep and this many parts of the codebase were switched to deep conversion that should have been shallow conversion.

I've gone through the code carefully to figure out what behaviour I changed from shallow list conversion to deep list conversion and fixed it. Patch is here:
https://github.com/kenpratt/biwascheme/commit/99e28ca8220b0c004ceb498a042dcc543d760fe6

I've changed it so that:

```
List(1, 2, [3]) == (list 1 2 (vector 3 4))
array_to_list(1, 2, [3]) == (list 1 2 (vector 3 4))
deep_array_to_list(1, 2, [3, 4]) == (list 1 2 (list 3 4))
```

So the only time you get a recursive conversion is when you ask for it with ```deep_array_to_list```.