`append` with `list` argument doesn't work

Hi there! I wonder to know whether it’s an expected behavior or a bug that when I pass the argument named as list to append it fails:

> (define (f list value) (append list (list value)))
> (f '(1) 2)
Error: illegal function 

, but this code works as expected:

> (define (f list_ value) (append list_ (list value)))
> (f '(1) 2)
(1 2)

list is kind of a reserved word in scheme (name of a built-in function it seems) so I would avoid it as a variable name anyway, if only for code readability purposes;

Personally, I have always considered that until definitely proven otherwise problems in my code come from my code and not from some bug in whatever software I’m using.

3 Likes