Skip to content

ready hm 21#31

Open
isyufu wants to merge 1 commit into
Clojure-Developer:mainfrom
isyufu:isyufu/hm-21
Open

ready hm 21#31
isyufu wants to merge 1 commit into
Clojure-Developer:mainfrom
isyufu:isyufu/hm-21

Conversation

@isyufu

@isyufu isyufu commented Mar 2, 2024

Copy link
Copy Markdown

No description provided.


(defn dir-in-walk? [x]
; [a {e {i 584}, f 29116, g 2557, h.lst 62596}]
(if (and (vector? x) (= 2 (count x)) (map? (second x))) true)

@astynax astynax Mar 5, 2024

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(if ... true) странно выглядит. Может быть and достаточно было бы?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сейчас код возвращает true или nil. Да, nil тоже "ложен", но как-то не хочется видеть в коде смешивание типов без нужды.


(defn dir-loc [name loc]
(let [[key value] (z/node loc)]
(if (and (= name key) (map? value)) loc)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лучше использовать when здесь.

@astynax

astynax commented Mar 5, 2024

Copy link
Copy Markdown
Contributor

Поставил зачёт. Отличный пример использования condp!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants