This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-06-15
Channels
- # admin-announcements (90)
- # beginners (36)
- # boot (169)
- # cider (18)
- # clojure (84)
- # clojure-australia (1)
- # clojure-brasil (20)
- # clojure-czech (2)
- # clojure-france (5)
- # clojure-germany (1)
- # clojure-india (8)
- # clojure-italy (39)
- # clojure-japan (14)
- # clojure-korea (2)
- # clojure-russia (9)
- # clojure-sg (1)
- # clojure-spain (16)
- # clojure-ukraine (1)
- # clojurebridge (20)
- # clojurescript (146)
- # code-reviews (48)
- # core-typed (1)
- # datomic (24)
- # editors (59)
- # euroclojure (6)
- # ldnclj (25)
- # off-topic (6)
- # onyx (3)
- # reagent (7)
Can someone take a look to a little project I made? Is not finished yet, but I’d like to have some feedback. It’s my first almost-complete Clojure software: https://github.com/mdallastella/fen-to-graph
Thanks
@slipset: coord-list should be a vector like [:a8 :b8 :c8 … :f1 :g1 :h1]
probably there are better ways to do it
any idea?
function f(ints) {
var result = [];
ints.forEach(i) {
result.push(i++);
}
return result;
}
instead of using map, I see
let me try to rewrite it using map
crap, it might actually be a reduce of some sort, since you might need to keep track of the row you're on 😞
@slipset: what about this:
(map-indexed (fn [i v] (keyword (str v (mod (inc i) 8 )))) (flatten (repeat 8 column-list)))
(def coord-list
(flatten
(map (fn [n] (map #(keyword (str % n)) column-list))
(range 8 0 -1))))
double map
@slipset what about the rest?
(map #(keyword (str %1 %2))(cycle column-list) (mapcat (partial repeat 8) (range 1 9)))
@slipset: this is what I need, thanks: (map #(keyword (str %1 %2)) (cycle files) (mapcat (partial repeat 8) (range 8 0 -1)))
from :a8 down to :h1
althugh seems like (filter board/valid-coord? ((apply juxt functions) position))
is repeated across all the pieces?
@slipset: juxt is a mind blowing and amazing function 😃
Yep, some code can be refactored 😃
mdallastella: rook-moves and bishop-moves are basically the same, just a function of how they move? up-left up-right-down-left down-right vs up right down left
To me it seems a bit strange with a record called Rook and a function called rook-moves, that's sort of what I'm trying to address.
@slipset: as soon as I come home from a customer, I’ll answer you, thanks