I have a representation of a matrix in grid.clj file:
(-> (grid 10 10)
(toggle 2 3 4 5)
(off 2 3 4 5)
(on 2 3 4 5))
It's a list of functionts, first one initializes a grid, others modify it.
Clojures' 'code is data' supposed to make it easy for me to modify that representation by adding an instrucion at the end of collection. List is an ordered collection right? Order matters. How do I add an instruction to the end of the list then?
Something like this:
(def grid (read-string (slurp "grid.clj")))
(conj grid '(off 1 2 3 6))
Yet I can't add to the end of the list, which is a data structure that is evaluatable as code. How is it 'code as data' if I can't add to the end of the ordered collection that is meant for code (as data)?
user=> (concat grid '((off 1 2 3 6)))
(-> (grid 10 10) (toggle 2 3 4 5) (off 2 3 4 5) (on 2 3 4 5) (off 1 2 3 6))
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/clojure/efd72013-a85e-46e8-b9db-10dde1a8a235n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/clojure/6cf09a4d-aedd-42e4-860c-35efcb68ed50n%40googlegroups.com.
On Jul 17, 2021, at 2:21 PM, Tanya Moldovan <tanya.m...@gmail.com> wrote:
To view this discussion on the web visit https://groups.google.com/d/msgid/clojure/CADBYUPvzMtspZxxc5PhmkXyNg7kJqgMG%3DWVkUe2FKsf%2BGsdaFA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/clojure/ed22c0d1-cc25-4127-b9ae-2f0733ee874bn%40googlegroups.com.