c(a|d)ⁿr

By Eutro
car, cdr, caaaaddddr, and everything in between.

(require cadnr) package: cadnr
c(a|d)ⁿr

This module extends a number of built-in Racket functions that have obvious arbitrary extensions.

Announcement: https://racket.discourse.group/t/c-a-d-r-car-cdr-caaaaddddr-and-everything-in-between/1876
(Discourse is an open source platform and the racket discourse does not track you or require a sign-in)

C(a|d)ⁿr - car, cdr, caaaaddddr, and everything in between

Am I getting this right - this is happening at macro expansion - extending the racket compiler handle arbitrary combinations? Am I right in assuming it be approximately as fast as the native functions at run time? Stephen

Racket Discussions

@racketlang

A package? Pfft.

My first real programming task when I became a freshman intern at my Univ's computing center was to write a Lisp interpreter for their Burroughs B3500 mainframe. In assembly lang. On punched cards, of course -- it was 1969.

My interpreter detected C{A,D}^nR functions, for any n, and evaluated them directly. 🧙‍♂️

@JorgeStolfi @racketlang

I think it could be possible to take a different approach, instead od defining functions beforehand, create a language extension that could interpret those combinations in compile time (during macro expansion).

@xgqt @JorgeStolfi @racketlang

Looking at the docs and code, i think this is doing exactly that.

Like the interpreter @JorgeStolfi created, this detects C{A,D}nR functions, for any n.

Unlike the interpreter version, this happens at macro expansion - extending the racket compiler handle arbitrary combinations - so will be as fast as the native functions at run time.

https://docs.racket-lang.org/cadnr/index.html

https://github.com/eutro/cadnr

c(a|d)ⁿr

@racketlang Disappointed that cr irst est ext pre are not identity functions
C(a|d)ⁿr - car, cdr, caaaaddddr, and everything in between

Am I getting this right - this is happening at macro expansion - extending the racket compiler handle arbitrary combinations? Am I right in assuming it be approximately as fast as the native functions at run time? Stephen

Racket Discussions