Recently, I was reminded about the nice λ
-based implementation of Scheme’s cons
, car
and cdr
“primitives” (or special forms, as Scheme calls them). Of course, being implemented just in terms of λ
doesn’t actually make them so “primitive” any more.
This is a nice example of how not only code is data, but also data is code.
Here’s the Scheme code and ports to many other languages:
- AmbientTalk: lambdaconscarcdr.at
- Arc: lambdaconscarcdr.arc
- Atomy: lambdaconscarcdr.ay
- Bard: lambdaconscarcdr.bard
- C#: lambdaconscarcdr.cs lambdaconscarcdr.csx
- Clojure: lambdaconscarcdr.clj
- Coco: lambdaconscarcdr.co
- Coconut: lambdaconscarcdr.coco
- CoffeeScript: lambdaconscarcdr.coffee
- CokeScript: lambdaconscarcdr.coke
- Common Lisp: lambdaconscarcdr.lisp
- Dart: lambdaconscarcdr.dart
- Dylan: lambdaconscarcdr.dylan
- E: lambdaconscarcdr.e
- ECMAScript: lambdaconscarcdr.es
- Elixir: lambdaconscarcdr.exs
- Erlang: lambdaconscarcdr.erl
- F-Script: lambdaconscarcdr.fscript
- Falcon: lambdaconscarcdr.falcon
- Grace: lambdaconscarcdr.grace
- Groovy: lambdaconscarcdr.groovy
- Hack: lambdaconscarcdr.hh
- Hy: lambdaconscarcdr.hy
- Io: lambdaconscarcdr.io
- Ioke: lambdaconscarcdr.ik
- Julia: lambdaconscarcdr.jl
- Lark: lambdaconscarcdr.lark
- LFE: lambdaconscarcdr.lfe
- LiveScript: lambdaconscarcdr.ls
- Lua: lambdaconscarcdr.lua
- Magpie: lambdaconscarcdr.mag
- MISC: lambdaconscarcdr.misc
- Monte: lambdaconscarcdr.mt
- Neko: lambdaconscarcdr.neko
- Newspeak: lambdaconscarcdr.ns
- Octave: lambdaconscarcdr.m
- Oz: lambdaconscarcdr.oz
- Perl: lambdaconscarcdr.pl
- PHP: lambdaconscarcdr.php
- Pico: lambdaconscarcdr.pico
- Pike: lambdaconscarcdr.pike
- Potion: lambdaconscarcdr.pn
- Pyret: lambdaconscarcdr.arr
- Python: lambdaconscarcdr.py
- REBOL: lambdaconscarcdr.r
- R: lambdaconscarcdr.Rscript
- Raku: lambdaconscarcdr.raku
- Ruby: lambdaconscarcdr.rb
- Scheme: lambdaconscarcdr.scm
- Seph: lambdaconscarcdr.sp
- Sidef: lambdaconscarcdr.sf
- Skew: lambdaconscarcdr.sk
- Smalltalk: lambdaconscarcdr.st
- Squirrel: lambdaconscarcdr.nut
- Wisp: lambdaconscarcdr.wisp
- Wren: lambdaconscarcdr.wren
- Yona: lambdaconscarcdr.yona