Comma is illegal outside of backquotes?

2.2k Views Asked by At

I am writing a function that is supposed to take in two values. The first value is supposed to create a list up to five numbers, based on the value entered. The second value is supposed to take the list and rotate it n times, based on the number entered.

Example of program interaction.

> (my_rotate_n 1,2)

> (3 4 5 1 2)

This is the function I currently have.

(defun my_rotate_n (y) (x)
    (append (loop for i from (+ 1 y) to (+ 4 y) collect i)
    (> x 0) (my_rotate_n (rotate-right y)(- x 1)))(list y))

When I test the function for an output I get the error: comma is illegal outside of backquotes Any suggestions?

1

There are 1 best solutions below

0
On

Comma:

The comma is part of the backquote syntax; see Section 2.4.6 (Backquote). Comma is invalid if used other than inside the body of a backquote expression as described above.

To separate tokens, use Whitespace Characters.

IOW, instead of (my_rotate_n 1,2) you should write (my_rotate_n 1 2).

(This will not make your my_rotate_n work, of course, just avoid that particular error. You should invest some of your time in studying Lisp syntax.)