Skip to content

Commit

Permalink
Use toolz.concat.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kodiologist committed Mar 22, 2024
1 parent 86b0915 commit 36fab5c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion simalq/tile/monster.hy
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@
:points-for-generator (classmethod (fn [cls] ~points-gen))
:flavor ~flavor-mon
:flavor-for-generator ~flavor-gen
~@(sum :start [] (gfor
~@(hy.I.toolz.concat (gfor
[k v] (.items kwargs)
[(hy.models.Keyword k) v])))
Expand Down
9 changes: 3 additions & 6 deletions simalq/tile/tilepedia.hy
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


(import
toolz [concat]
metadict [MetaDict]
simalq.color
simalq.game-state [G]
Expand Down Expand Up @@ -97,9 +98,9 @@
:href (+ "#" tile.id)))))))))

; One section of info screens per superclass
#* (cat (gfor
#* (concat (gfor
[superclass-name tiles] (.items info)
[(E.h2 superclass-name) #* (cat (gfor
[(E.h2 superclass-name) #* (concat (gfor
; One info screen per tile type
tile tiles
[(E.h3 (mapsym tile) tile.long-name :id tile.id)
Expand Down Expand Up @@ -131,9 +132,5 @@
(if self-closing "" f"</{(hesc tag)}>")))


(defn cat [l]
(sum :start [] l))


(when (= __name__ "__main__")
(print (html)))
4 changes: 3 additions & 1 deletion tests/lib.hy
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
(require
hyrule [do-n unless])
(import
toolz [concat]
metadict [MetaDict]
simalq.geometry [Pos at Direction]
simalq.un-iq [iq-quest]
Expand Down Expand Up @@ -82,7 +83,8 @@
(hy.I.simalq/tile.Player :pos (Pos model player-x player-y)))
(assert (= G.map.width model.width))
(assert (= G.map.height model.height))
(for [[stack-actual stack-expected] (zip (sum :start #() G.map.data) (sum :start #() model.data))]
(for [[stack-actual stack-expected]
(zip (concat G.map.data) (concat model.data))]
(assert (= (len stack-actual) (len stack-expected)))
(for [[t-actual t-expected] (zip stack-actual stack-expected)]
(assert (= t-actual.stem t-expected.stem)))))
Expand Down

0 comments on commit 36fab5c

Please sign in to comment.