# Illustrate "anonymous recursive functions" à la PowerShell

**URL:** <https://racket.discourse.group/t/illustrate-anonymous-recursive-functions-a-la-powershell/3932>\
**Category:** Show & Tell\
**Created:** [September 6, 2025, 12:07pm UTC](https://racket.discourse.group/t/illustrate-anonymous-recursive-functions-a-la-powershell/3932 "2025-09-06T12:07:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![spdegabrielle](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/spdegabrielle/32/95_2.png) [@spdegabrielle](https://racket.discourse.group/u/spdegabrielle)\
**Post date:** [September 6, 2025, 12:07pm UTC](https://racket.discourse.group/t/illustrate-anonymous-recursive-functions-a-la-powershell/3932/1 "2025-09-06T12:07:53Z")

</div>

> Wrote up a nice little macro in @racketlang to illustrate "anonymous recursive functions" à la PowerShell.  
> [GitHub - shriram/anonymous-recursive-function: Anonymous recursive functions in Racket](https://github.com/shriram/anonymous-recursive-function?tab=readme-ov-file)

[https://discord.com/channels/571040468092321801/832076990923669554/1412961060129865768](https://discord.com/channels/571040468092321801/832076990923669554/1412961060129865768)

Posted in discord #Show & Tell by @shriramk

---

<div class="post-metadata">

**Author:** ![shawnw](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/shawnw/32/1031_2.png) [@shawnw](https://racket.discourse.group/u/shawnw)\
**Post date:** [September 6, 2025, 7:12pm UTC](https://racket.discourse.group/t/illustrate-anonymous-recursive-functions-a-la-powershell/3932/2 "2025-09-06T19:12:52Z")

</div>

The mentioned `rec` macro is also in [`srfi/31`](https://docs.racket-lang.org/srfi/srfi-31.html), which I'd use in preference of dragging in the legacy mzlib libraries.

The SRFI-31 documentation mentions the `named-lambda` form that was in very early versions of Scheme (It was dropped in R3RS). I resurrected it for my [`soup` library](https://docs.racket-lang.org/soup-lib/index.html) as another alternative:

```scheme
(require soup-lib/control)
((named-lambda (fact n) (if (zero? n) 1 (* n (fact (sub1 n))))) 5) ; 120

```

A Clojure style `loop`/`recur` form would be easy to implement too (Assuming nobody's done it yet. Edit: Someone [did it](https://stackoverflow.com/a/79587463/9952196). And by someone I mean me. I'd forgotten about that.)
