This article is a tutorial on using monads in Lean 4, a programming language whose monadic features closely resemble those of functional languages like Haskell and OCaml. It begins with a motivating example—evaluating expressions—to illustrate how monads work in practice.
This post demonstrates how to use monads in the Lean programming language
(Lean 4, to be specific). If you're not familiar with Lean, this part of the
language is very similar to other functional programming languages, like
Haskell or OCaml.
Motivating example - evaluating expressions
Suppose we want to write a …
继续阅读全文
为了尊重作者,这里只展示开头几段。你可以去原文阅读,或者在 HorizonReader 里读:划线做笔记、让 AI 帮忙。
AI 摘要The article introduces the discrete Fourier transform (DFT), building on a previous post that covered the Discrete-Time Fourier Series (DTFS) and Discrete-Time Fourier Transform (DTFT) for analyzing infinite-duration periodic and non-periodic discrete signals. It now shifts the focus to realistic digital signal processing, where signals are not only discrete but also finite in duration.
One of the most wonderful aspects of math is how deep we can get by studying seemingly trivial questions. Consider the roots of unity, where "unity" simply means the number 1. Basics: roots of unity for real numbers Studying the roots of un
AI 摘要Monte Carlo simulations are a technique that applies randomness and the Law of Large Numbers to solve various scientific and engineering problems. One of their earliest documented uses was by Stanislaw Ulam and John von Neumann for nuclear weapon simulations after World War II.
AI 摘要The author reviews 'Wuthering Heights' by Emily Brontë as part of their reading summary for July-September 2026. They praise the quality of the writing but find it hard to like any of the characters, describing them as crazy, evil, or stupid. The author also reflects on how small and confined the world was for people in that era.