frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

De Bruijn Numerals

https://text.marvinborner.de/2023-08-22-22.html
30•marvinborner•2h ago

Comments

tromp•2h ago
> Christopher Wadsworth analyzed different properties of numeral systems and the requirements they have to fulfill to be useful for arithmetic.

> Specifically, he calls a numeral system adequate if it allows for a successor (succ) function, predecessor (pred) function, and a zero? function yielding a true (false) encoding when a number is zero (or not).

A numeral system is adequate iff it can be converted to and from Church numerals. Converting from Church numerals requires functions N0 and Nsucc so that

    Church2Num c = c Nsucc N0
while converting to Church numerals requires functions Nzero? and Npred so that

    Num2Church n = Nzero? n C0 (Csucc (Num2Church (Npred n)))
with an implicit use of the fixpoint combinator.

An interesting adequate numeral system is what i call the tuple numerals [1], which are simply iterates of the 1-tuple function T = λxλy.y x

So N0 = id, Nsucc = λnλx.n (T x), Npred = λnλx.n x id, and Nzero? = λnλtλf. n (K t) (K f).

These tuple numerals are useful in proving lower bounds on a functional busy beaver [2].

[1] https://github.com/tromp/AIT/blob/master/numerals/tuple_nume...

[2] https://oeis.org/A333479 (see bms.lam link)

emptybits•1h ago
If you’re “into” de Bruijn numerals or Project Euler then you might be familiar with this little treat:

https://projecteuler.net/problem=941

Otherwise, have a go and don’t spoil it! (I have failed thus far.)

Joker_vD•6m ago
Just use Scott-Mogensen encoding, seriously.

    Zero = z. s. z
    Succ = n. z. s. s n

    isZero = n. n True (_. False)
    pred   = n. n Zero (r. r)
Addition requires explicit recursion, however (since numbers aren't folds), so I guess you'll have to either use Y combinator or closure-convert manually:

    add' = add'. m. n. m n (r. Succ (add' add' r n))
    add = add' add'
In any case, arithmetic operations can't be made fully constant-time for obvious reasons so whether your prefer this to Church numerals is a matter of taste. However, for lists/tuples the ability to execute head/tail/cons in constant time is much more important in practice than being able to do append in constant time.

Heretic: Automatic censorship removal for language models

https://github.com/p-e-w/heretic
139•melded•2h ago•35 comments

FPGA Based IBM-PC-XT

https://bit-hack.net/2025/11/10/fpga-based-ibm-pc-xt/
48•andsoitis•2h ago•7 comments

Only three kinds of AI products work

https://www.seangoedecke.com/ai-products/
21•emschwartz•1h ago•17 comments

Brimstone: ES2025 JavaScript engine written in Rust

https://github.com/Hans-Halverson/brimstone
129•ivankra•6h ago•60 comments

De Bruijn Numerals

https://text.marvinborner.de/2023-08-22-22.html
30•marvinborner•2h ago•3 comments

AirPods libreated from Apple's ecosystem

https://github.com/kavishdevar/librepods
1074•moonleay•17h ago•310 comments

Running the "Reflections on Trusting Trust" Compiler

https://research.swtch.com/nih
79•naves•4h ago•2 comments

Garbage Collection Is Useful

https://dubroy.com/blog/garbage-collection-is-useful/
50•surprisetalk•4h ago•5 comments

Fourier Transforms

https://www.continuummechanics.org/fourierxforms.html
16•o4c•1w ago•2 comments

Anthropic's report smells a lot like bullshit

https://djnn.sh/posts/anthropic-s-paper-smells-like-bullshit/
580•vxvxvx•6h ago•187 comments

Measuring the doppler shift of WWVB during a flight

https://greatscottgadgets.com/2025/10-31-receiving-wwvb-with-hackrf-pro/
65•Jyaif•1w ago•0 comments

PgFirstAid: PostgreSQL function for improving stability and performance

https://github.com/randoneering/pgFirstAid
43•yakshaving_jgt•4h ago•2 comments

The Internet Is No Longer a Safe Haven

https://brainbaking.com/post/2025/10/the-internet-is-no-longer-a-safe-haven/
158•akyuu•4h ago•119 comments

Vintage Large Language Models

https://owainevans.github.io/talk-transcript.html
25•pr337h4m•4h ago•6 comments

Why use OpenBSD?

https://www.tumfatig.net/2025/why-are-you-still-using-openbsd/
105•akagusu•5h ago•59 comments

Production-Grade Container Deployment with Podman Quadlets – Larvitz Blog

https://blog.hofstede.it/production-grade-container-deployment-with-podman-quadlets/index.html
23•todsacerdoti•4h ago•10 comments

Iran begins cloud seeding operations as drought bites

https://www.arabnews.com/node/2622812/middle-east
93•mhb•4h ago•89 comments

Maybe you’re not trying

https://usefulfictions.substack.com/p/maybe-youre-not-actually-trying
278•eatitraw•7h ago•130 comments

IDEmacs: A Visual Studio Code clone for Emacs

https://codeberg.org/IDEmacs/IDEmacs
273•nogajun•17h ago•111 comments

Dissecting Flock Safety: The Cameras Tracking You Are a Security Nightmare [video]

https://www.youtube.com/watch?v=uB0gr7Fh6lY
37•emsign•2h ago•4 comments

Run Nix Based Environments in Kubernetes

https://flox.dev/kubernetes/
85•kelseyhightower•6d ago•23 comments

Things that aren't doing the thing

https://strangestloop.io/essays/things-that-arent-doing-the-thing
405•downboots•23h ago•189 comments

UK's first small nuclear power station to be built in north Wales

https://www.bbc.com/news/articles/c051y3d7myzo
125•ksec•7h ago•173 comments

Writing a DOS Clone in 2019

https://medium.com/@andrewimm/writing-a-dos-clone-in-2019-70eac97ec3e1
55•shakna•1w ago•18 comments

Alchemy

https://joshcollinsworth.com/blog/alchemy
17•tobr•6d ago•8 comments

Our investigation into the suspicious pressure on Archive.today

https://adguard-dns.io/en/blog/archive-today-adguard-dns-block-demand.html
1690•immibis•1d ago•419 comments

libwifi: an 802.11 frame parsing and generation library written in C (2023)

https://libwifi.so/
141•vitalnodo•19h ago•13 comments

Interactive Spectrum Chart

http://www.potatofi.com/posts/spectrum-viewer/
10•throw0101d•1w ago•4 comments

Owning a Cat Could Double Your Risk of Schizophrenia, Research Suggests

https://www.sciencealert.com/owning-a-cat-could-double-your-risk-of-schizophrenia-research-suggests
6•amichail•38m ago•0 comments

Boa: A standard-conforming embeddable JavaScript engine written in Rust

https://github.com/boa-dev/boa
263•maxloh•1w ago•67 comments