Questions tagged [repl-printed-representation]

Questions concerned with appearance of return values as printed by REPL.

Questions concerned with appearance of return values as printed by REPL.

6 questions
7
votes
1 answer

Behavour of nested quotes in Scheme and Racket

While writing a function in Racket I accidently put two single quotes in front of a symbol instead of one. i.e. I accidently wrote ''a and discovered some behaviour of nested quotes that seems strange. I'm using DrRacket and tested this with both…
Harry Spier
  • 1,343
  • 13
  • 27
4
votes
2 answers

What is ' (apostrophe) in Racket?

I am a little confused about the meaning of the ' sign in racket. It appears to me that the same sign has different meanings. Look at 2 simple examples below: list Returns a newly allocated list containing the vs as its elements. > (list 1 2 3…
1
vote
1 answer

Why does the list result returned by my function look funny?

(define (evenList xs) (cond ((null? xs) '()) ((eq? (cdr xs) '()) '()) (else (cons (cadr xs) (evenList (cddr xs)))))) I'm using this code but it doesn't create the list the way I want it. (evenList (list 1 2 3 4))…
1
vote
2 answers

behavior of quote in racket

I'm used to (quote x) evaluating to x, (quote (x y z)) evaluating to (x y z), and (car (quote (x y z)) evaluating to x. The reasoning is simple: quote is a special form that does not evaluate its argument, but simply returns it as is. I just…
0
votes
3 answers

Can one use cons to do ((a . b) . (c . d)) and if not any other means or dot pair cannot have 2nd element like this?

;;; <- can one use cons to do ((a . b) . (c . d))? (define x (cons a b)); nil -- should it be error (define x (cons 'a 'b)); (a . b) (define y (cons 'c 'd)); (c . d) (define z00 (cons x y)) ; (((a . b) c . d) <- cannot use cons to do ((a . b)…
0
votes
1 answer

Count occurrences in lisp

I'm trying to make a code in lisp to count occurrences of atoms in a list in lisp. The problem is the code works for all atoms except the atom (), which appears as NIL. Example in the code: (defun flatten (list_) (cond ((atom list_) (list…