0

i have some task that ask me to create a list in LISP , so I'm using clips online and I made this code the create my list and do some operations

‭‬‬‬‬
‭(‬print‭ (‬setq y‭ '(‬2‭ ‬3‭ ‬4‭ ‬5‭ ‬6‭ ‬7‭ ‬8‭)))‬‬‬‬‬‬‬‬‬‬‬
‭(‬print‭  (‬setq y‭ (‬cons 1‭ ‬y‭)))‬‬‬‬‬‬
‭(‬print‭  (‬setq y‭ (‬append y‭ '(‬9‭))))‬‬‬‬‬‬
‭(‬print‭  (‬car y‭))‬‬‬‬
‭(‬print‭  (‬second y‭))‬‬‬‬
‭(‬print‭  (‬third y‭))‬‬‬‬
‭(‬print‭  (‬fourth y‭))‬‬‬‬
‭(‬print‭  (‬fifth y‭))‬‬‬‬
‭(‬print‭  (‬last y‭))‬‬‬‬
‭(‬print‭ (‬second‭ (‬reverse y‭)))‬‬‬‬‬
‭(‬print‭  (‬setq y‭ (‬reverse y‭)))‬‬‬‬‬
‭(‬print‭  (‬setq y‭ (‬cdr y‭)))‬‬‬‬‬
‭(‬print‭  (‬setq y‭ (‬reverse‭ (‬cdr‭ (‬reverse y‭)))))‬‬‬‬‬‬‬
‭(‬print‭  (‬length y‭))‬‬‬‬
‭(‬print‭  (‬member 9‭ ‬y‭))‬‬‬‬‬

and this error appears without any other output:

*** - EVAL: variable ‭‬‬‬‬ has no value

can you please help me understand what's wrong and what to do? thank you

1 Answer 1

3

you should ask yourself why your code contains non-printing characters. Just try again to use a program without hidden characters.

> (length "‭(‬print‭ (‬setq y‭ '(‬2‭ ‬3‭ ‬4‭ ‬5‭ ‬6‭ ‬7‭ ‬8‭)))‬‬‬‬‬‬‬‬‬‬‬")
63

without hidden characters:

> (length "(print (setq y '(2 3 4 5 6 7 8)))")
33

As Bruno Haible mentioned, we can see it more clearly:

[1]> (coerce "(‬print‭ (‬setq y‭ '(‬2‭ ‬3‭ ‬4‭ ‬5‭ ‬6‭ ‬7‭ ‬8‭)))‬‬‬‬‬‬‬‬‬‬‬" 'list)
(#\( #\POP_DIRECTIONAL_FORMATTING #\p #\r #\i #\n #\t #\LEFT-TO-RIGHT_OVERRIDE #\Space #\( #\POP_DIRECTIONAL_FORMATTING #\s #\e #\t #\q #\Space #\y #\LEFT-TO-RIGHT_OVERRIDE #\Space #\' #\( #\POP_DIRECTIONAL_FORMATTING #\2
 #\LEFT-TO-RIGHT_OVERRIDE #\Space #\POP_DIRECTIONAL_FORMATTING #\3 #\LEFT-TO-RIGHT_OVERRIDE #\Space #\POP_DIRECTIONAL_FORMATTING #\4 #\LEFT-TO-RIGHT_OVERRIDE #\Space #\POP_DIRECTIONAL_FORMATTING #\5 #\LEFT-TO-RIGHT_OVERRIDE
 #\Space #\POP_DIRECTIONAL_FORMATTING #\6 #\LEFT-TO-RIGHT_OVERRIDE #\Space #\POP_DIRECTIONAL_FORMATTING #\7 #\LEFT-TO-RIGHT_OVERRIDE #\Space #\POP_DIRECTIONAL_FORMATTING #\8 #\LEFT-TO-RIGHT_OVERRIDE #\) #\) #\)
 #\POP_DIRECTIONAL_FORMATTING #\POP_DIRECTIONAL_FORMATTING #\POP_DIRECTIONAL_FORMATTING #\POP_DIRECTIONAL_FORMATTING #\POP_DIRECTIONAL_FORMATTING #\POP_DIRECTIONAL_FORMATTING #\POP_DIRECTIONAL_FORMATTING
 #\POP_DIRECTIONAL_FORMATTING #\POP_DIRECTIONAL_FORMATTING #\POP_DIRECTIONAL_FORMATTING #\POP_DIRECTIONAL_FORMATTING)
Sign up to request clarification or add additional context in comments.

1 Comment

You can see the hidden characters by executing (coerce "(‬print‭ (‬setq y‭ '(‬2‭ ‬3‭ ‬4‭ ‬5‭ ‬6‭ ‬7‭ ‬8‭)))‬‬‬‬‬‬‬‬‬‬‬" 'list).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.