Fork me on GitHub
#exercism
<
2023-10-13
>
Bobbi Towers01:10:45

I deprecated the lists exercise and replaced it with a new one, Card Games: https://exercism.org/tracks/clojure/exercises/card-games

roelof11:10:02

@porkostomus bummmer, did then that one for nothing 😞

slipset11:10:15

Not at all. You get to ponder why it was deprecated and how that exercise is influenced other languages, but mostly totally meaningless in Clojure.

roelof12:10:21

Also a valid point. But then first wait on mentoring on a challenge I submittted yesterday

Bobbi Towers12:10:09

The strange part is, that exercise was actually written for Clojure. It was the first one created for the syllabus, before we really knew what we were doing

Bobbi Towers13:10:19

We need an exercise for teaching maps, but I tried porting the dictionaries exercise from the C# track and it's the same situation, it's all about writing functions to create a map, add something to a map, remove an item, replace an item. All things that you actually have to learn to do in other languages, but in Clojure just amount to wrapping a core function (or in the case of creating a map, just typing 2 characters), which I can't bring myself to ask of people. There's value in porting exercises from other tracks because it provides something familiar to students who have seen the exercise before, and creates a consistent tone across the website. But I think this is a situation where I just need to write one from scratch.

slipset13:10:40

I think that from my daughters perspective, the first thing for her to grasp is the concept of a mapping. We did the robot thingy together yesterday, and I did use some maps there for figuring out the next direction on a right or left move. This made sense to her. We haven’t gone into mutating maps yet, although we actually did that in the robot thing, but I framed it more in terms of the update fn than on maps.

roelof13:10:18

@slipset which robot one did you do then ? As far as I know there are 2 robot challenges

Bobbi Towers13:10:07

robot-simulator is the one with the turns

roelof13:10:28

and then you have robot-name . which I think you can use a list to keep track that there are not 2 with the same name @porkostomus

slipset13:10:21

I was thinking of the robot simulator

slipset13:10:55

Spoiler alert 🙂

(def right {:n :e
            :e :s
            :s :w
            :w :n})

(def left {:n :w
           :w :s
           :s :e
           :e :n})

(defn advance [c d]
  (cond (= d :n) (update c 1 inc)
        (= d :w) (update c 0 dec)
        (= d :s) (update c 1 dec)
        (= d :e) (update c 0 inc)))

(defn move-robot [coords inst]
  (cond (= \R inst) (update coords :d right)
        (= \L inst) (update coords :d left)
        (= \A inst) (update coords :c advance (:d coords))
        :else (do (println "this is not a legal instruction:" inst) coords)))

(reductions move-robot {:c [7 3] :d :n} "RAALALx")

roelof13:10:57

that one I did not try. Looked too diffulcult for a beginner in clojure

Bobbi Towers18:10:40

Added the "Coordinate Transformation" exercise, which teaches atoms and closures https://exercism.org/tracks/clojure/exercises/coordinate-transformation

roelof18:10:21

Thanks, looks also a complex one to learn clojure as a beginner

Bobbi Towers19:10:06

I ported it from the JavaScript track. I struggled with it as a student because I hadn't learned any JavaScript before, but it seemed to port to Clojure pretty nicely. The memoization part was difficult for me, but then I found an example from the Clojure documentation that fit the problem perfectly, so it's linked in the hints.

roelof19:10:58

two challenges to do and then i did all the concepts one