Skip to content

Conversation

isyufu
Copy link

@isyufu isyufu commented Mar 2, 2024

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)
Copy link
Contributor

@astynax astynax Mar 5, 2024

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
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
Contributor

Choose a reason for hiding this comment

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

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

@astynax
Copy link
Contributor

astynax commented Mar 5, 2024

Поставил зачёт. Отличный пример использования 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