Yes that is pretty smart. One of my game design friends mentioned the same thing after I showed him the code. I sometimes feel I am still living in that oo mindset
I wrote Snake in 100 lines of ClojureScript for a talk at UCT a few years ago and used that shape of data structure: http://theronic.github.io/cljs-snake/
For anything more complex, I immediately reach for DataScript as a client-side Datalog DB.
Thank you. I think your design is stellar. I'm keen to go through your code too. Since moving to clojure I have found myself reading much more source code
As a next challenge, can you ensure the board is solvable without guessing? You have to delay generating it until the user has done that first click, but there are some other constraints as well.
Also, you probably want to stop clicks on marked squares from exploding the mine.
A convinent source of information about this is going to be Simon Tatham's excellent puzzle suite. Most the puzzles are built to ensure a solution without guessing.
You can’t have enclosed areas that contain mines, there’s probably a few others.
The easiest thing to do is to write a solver which will iteratively mark squares it knows to contain a mine, or knows don’t contain a mine. If the solver can find all the mines the board is solvable. Only present the user with boards that your solver can solve.
Not parent: if you click a square and it says 7/6 then sometimes (next to a corner) you can only guess, you can't deduce the correct square to flag. There are others.
I learned Haskell first, and I thought it was a valuable learning experience. Laziness and type driven development give you a different perspective on solving problems. That said, I find Clojure to be both simpler and more pragmatic than Haskell. It requires knowing less concepts to use effectively, it encourages interactive development, and it leverages two of the biggest ecosystems by targeting the JVM and Js environments. I would recommend learning Clojure unless you feel strongly about having pervasive static typing.
Here's a video of the creator of Clojure explaining his preference for dynamic vs static languages, and how he came to the choice of making Clojure dynamic, that may help inform your decision:
I recommend Haskell over Clojure, because it will really expand and bend your mind. (I take as context your asking this question.)
Then, I recommend Common Lisp over Clojure, because that has a lot of things that are uncommon even decades after standardization.
Finally, for a practical, day-to-day driver language, Clojure is really good. It's a personal go-to for any server side coding I have to do. (I rarely do front end work and have no preferences there beyond Unity if it is a game.)
My personal experience is that most programmers either like or don't like type systems. If you don't I would highly recommend Clojure, if you do I would highly recommend Haskell.
As others have said, it’s a question of what you want to get from learning.
Haskell primarily tries to answer the question, “What are static type systems capable of, and what new relationships can we achieve between code representation and code execution?”
Clojure primarily tries to answer the question, “How can we write programs more efficiently in the (relatively) short term?”
Learn both. If you have no functional programming experience then learning clojure first should help you get comfortable with higher order functions and other functional paradigms before diving into the type theory side of things with Haskell.
>Compared to Clojure
Rich borrowed almost all of Clojure’s standard library from Haskell.
Destructuring in Clojure also looks like it came directly from Haskell.
Don't know if Rich first got the idea from Lisp or not, but it seems likely since he did a bunch of development in Common Lisp (generating C++, of all things :-D ) ages ago.
I don't remember if I heard him talk about that in the "Expert to Expert" video ( https://www.youtube.com/watch?v=wASCH_gPnDw ), or in "Simple Made Easy" ( https://www.youtube.com/watch?v=34_L7t7fD_U ). I think it was the former, but both of those are worth watching multiple times. It's also entirely possible that it was in an entirely different video of his -- but it was him.
I've yet to be disappointed in any of his talks, so if I'm wrong about the exact one, just keep watching any of his talks on YouTube till you find it. xD
Anecdotally...I'd say "hell no". I programmed in Haskell before Clojure, and starting out I was never like "this is dynamic Hasell!!" or something. The standard library never gave me Haskell vibes whatsoever. Functional programming? Sure. I don't think anyone has the market cornered on "map" or "filter".