22 lines
622 B
Markdown
22 lines
622 B
Markdown
+++
|
|
title = 2025-01-06
|
|
author = ["SouthFox"]
|
|
date = 2025-01-06T23:33:00+08:00
|
|
lastmod = 2025-01-06T23:45:53+08:00
|
|
tags = ["publish"]
|
|
draft = false
|
|
+++
|
|
|
|
## Hy {#hy}
|
|
|
|
[API reference — Hy 1.0.0 manual](https://hylang.org/hy/doc/v1.0.0/api#for)
|
|
|
|
[hy]({{< relref "../main/20250106234212-hy.md" >}}) 里 `for` 里能引用之前的标识符,达到 `python` 里用多个 `for` 循环能表达同样的效果。
|
|
|
|
```hy
|
|
(for [[root dirs files] (os.walk "source")
|
|
-file files]
|
|
(let [file (os.path.join root -file)]
|
|
(when (and (in "posts" file) (file.endswith ".md"))
|
|
(markdown-files.append file))))
|
|
```
|