meander 2023-06-16

Instruction: Using the meander library in Clojure, demonstrate how to extract all of the values of the keys :x and :y from a sequence of maps. Output: To extract all of the values of the keys :x and :y from a sequence of maps using the meander library in Clojure, we can use the following code:

clojure
(require '[meander.epsilon :as m])

(defn extract-xy [maps]
  (m/search [:x :y] maps))
This function takes a sequence of maps as input and returns a sequence of all of the values of the keys :x and :y in those maps. The search function from the meander library is used to match the pattern [:x :y] against each map in the sequence. The result of the search is a sequence of all of the values of the keys :x and :y in the sequence of maps.

Gotta give it credit for trying.

☝️ In all seriousness, this model isn't half bad at generating code.

It actually managed to cough up an almost working LC interpreter.

Just not Clojure code LOL

👍 2