0

By following code:

(struct int (num) #transparent)

(list (int 3) (int 5)) ;; case-1
'((int 3) (int 5))     ;; case-2

the case-1 prints (#(struct:int 3) #(struct:int 5)), but the case-2 prints ((int 3) (int 5)).

How can I deal with the second one as a struct:int list?

Seokmin Hong
  • 612
  • 1
  • 5
  • 15
  • Possible duplicate of [What is the difference between quote and list?](https://stackoverflow.com/questions/34984552/what-is-the-difference-between-quote-and-list) – Alexis King May 24 '17 at 22:12

1 Answers1

1

The expression:

'((int 3) (int 5))

is more or less equivalent to:

(list (list 'int 3)  (list 'int 5))

So if you want to create a list with a structure as an element, either use list directly or ... you can use quasiquote:

`(,(int 3) ,(int 5))
soegaard
  • 30,661
  • 4
  • 57
  • 106