Creating a minesweeper board with positions

Creating a minesweeper board with positions

Hello again fellow Clojurains.

God I feel like I've posted here so much.

So recently I've tried to pick myself by the bootstraps instead of being a pussy about starting a tangible project. The biggest problem I have (with programming in general as of late) it that I overthink how to write functions. Clojure makes it easier, but again, I overthink it.

The idea is that I wanted to make more of a text based CLI minesweeper with Clojure. I've created the function that would be a square and assigned it to sqr (ns simple.core (require [clojure.math.numeric-tower :as math]) (:gen-class))

(defn sqr* "make a square" [starter] (math/expt starter 2)) (def sqr (sqr*)) 

The part where I'm stumped is mapping labeled positions (a0 a1 a2 a3 etc) via sqr. What I would have to do is take what number (sqr*) get's given (that would be the length of the square) and use alpha-start and alpha-end and after that would just be picking a random position(s) in the square to be "mines."

(def alpha-start 97) (def alpha-end 123) (def letters (map (comp str char) (range alpha-start alpha-end))) 

Is what I have for the letters.

I know what to do it's just a matter of how to do it. I know at some point to map the labeled positions I'd have to use (let []) to create a function that gives the area of sqr then use that function to (map) the labeled positions. Again, it's frustrating because I over think things.

Submitted August 20, 2017 at 04:14AM by ProfessorSexyTime
via reddit

How are you inspecting data(structures)?

How are you inspecting data(structures)?

When I work with various APIs I often get back deeply nested data structures (JSON/Maps). Often I'm only interested in parts of the data.

I find it useful to look at the data and its structure before I write code to pluck out what I need. Sometimes I just print it out but that unless the structure is small it is difficult to comprehend for me. Another handy tool is proto-repl in Atom which can inline a tree you can click around in. That said it also has its limits when the structure is very large.

Since I am trying out Visual Studio Code at the moment and it lacks the features I'm used to from proto-repl (as far as I know) I was curious what your go-to tool is for this use case.

I found the following two inspectors for browsing data structures: one is swing based and comes with Clojure, the other one is browser based and an external library (see below) but I was wondering if there is something 'better' that I'm not aware of.

Submitted August 20, 2017 at 02:09AM by __tosh
via reddit

General consensus on Fulcro?

General consensus on Fulcro?

I currently use Reagent + Re-Frame, I enjoyed it at first but at this point I think it's getting unwieldy. The code base is gigantic (for me), I've been working on it for like 3 months, this is the third from-scratch rewrite, but I was considering Om.Next when I learned about Fulcro.

It seems pretty cool, and I like the bundled solution, because I was doing everything from scratch.


Submitted August 19, 2017 at 11:26PM by antflga
via reddit