Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ready hm 21 #31

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

ready hm 21 #31

wants to merge 1 commit into from

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