Closed bobbicodes closed 3 years ago
@porkostomus very nicely explained, I learned a lot also! I have a quick question, apart from vectors is a function in Clojure, I feel like it's quite similar to Java List or Array, am I right?
The vector concepts unlocks quite some concepts below, I'm kind of lost how we handle this in the implementation of this concept vector, do we explain them individually or simply link to some references?
collection
array
immutability
function
structural sharing
sequences
I think the main difference with arrays is the way they are implemented. I think arrays are usually contiguous blocks in memory, but Clojure's vectors are actually the same "hash-array map tries" as in Clojure maps.
Finished, see #1835
This issue describes how to implement the
vectors
concept exercise for the Clojure track.Getting started
Please please please read the docs before starting. Posting PRs without reading these docs will be a lot more frustrating for you during the review cycle, and exhaust Exercism's maintainers' time. So, before diving into the implementation, please read up on the following documents:
Goal
The goal of this exercise is to teach the student how vectors are used in Clojure. This is also the first major point of departure from Lisps which use lists primarily, providing a clean distinction between code (i.e. lists, which always represent a function call and are executed), and data, which is not. Vectors have tremendous utility and are extremely common, and used to designate local bindings, arglists and destructuring syntax.
Things to teach
conj
ed onto the endget
,assoc
Things not to teach
No knowledge of functions is assumed at this point, but it should probably be mentioned that vectors are functions which retrieve their elements by their index.
Concepts
collection
array
immutability
function
structural sharing
sequences
Prerequisites
This is a root-level concept and not dependent upon any others.
Resources to refer to
Hints
After
Representer
No special requirements are needed for this exercise.
Analyzer
No special requirements are needed for this exercise.
Implementing
To implement a concept exercise, the following files must be created:
Help
If you have any questions while implementing the exercise, please post the questions as comments in this issue.