1 / 8

Unlambda: Unique Functional Programming Language

Explore Unlambda, a powerful functional programming language designed for abstraction-elimination. Learn about its syntax, functions, numbers like Church integers, and see an example of computing Fibonacci numbers. Dive into the unconventional world of Unlambda and its quirky reputation. Discover more about this fascinating language and its peculiarities.

jwaymire
Download Presentation

Unlambda: Unique Functional Programming Language

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The University of North Carolina at Chapel Hill Lecture 28: More on Functional Programming COMP 144 Programming Language Concepts Spring 2002 Felix Hernandez-Campos April 1 COMP 144 Programming Language Concepts Felix Hernandez-Campos

  2. Advanced Functional Programming • Functional programming languages can increase readability • But they can also help developing obfuscated code • Unlambda is a functional programming language specifically designed for this task • It is powerful (Turing-complete) • It is the ideal language for abstraction-elimination COMP 144 Programming Language Concepts Felix Hernandez-Campos

  3. Programming Principles • Seven primitive functions : • k, • s, • i, • v, • d, • C, and • .x COMP 144 Programming Language Concepts Felix Hernandez-Campos

  4. Numbers • Church integers: • <0> is ^f^x$x (i.e. `ki). • <1> is ^f^x`$f$x (i.e. i). • <2> is ^f^x`$f`$f$x (i.e. ``s``s`kski). • <3> is ^f^x`$f`$f`$f$x (i.e. ``s``s`ksk``s``s`kski). • and so on… COMP 144 Programming Language Concepts Felix Hernandez-Campos

  5. Example: Fibonacci • The following Unlambda program calculates and prints the Fibonacci numbers (as lines of asterisks) ```s``s``sii``s`kk`ki`ki``s``s`ks``s``s`ks``s`kk`ks``s``s`ks``s``s`ks` `s`kk`ks``s``s`ks``s``s`ks``s`kk`ks``s``s`ks``s``s`ks``s`kk`ks``s``s`k s``s`kk`kk``s`kk`kr``s``s`ks``s``s`ks``s`kk`ks``s``s`ks``s``s`ks``s`kk `ks``s``s`ks``s`kk`kk`ki``s``s`ks``s`kk`kk``s`kk`k.*``s``s`ks``s`kk`kk ``s`kki``s``s`ks``s`kk`kk``s`kki``s`kk`ki``s``s`ks``s``s`ks``s`kk`ks`` s``s`ks``s``s`ks``s`kk`ks``s``s`ks``s`kk`kk``s`kk`k``s``s`ks``s``s`ks` `s`kk`ks``s``s`ks``s``s`ks``s`kk`ks``s``s`ks``s`kk`kk``s`kk`ks``s``s`k s``s``s`ks``s`kk`ks``s``s`ks``s``s`ks``s`kk`ks``s``s`ks``s`kk`kk``s`kk `ks``s``s`ks``s``s`ks``s`kk`ks``s``s`ks``s`kk`kk``s`kk`kk``s``s`ks``s` kk`kk``s`kki``s``s`ks``s``s`ks``s`kk`ks``s``s`ks``s`kk`kk``s`kk`kk``s` kk`ki``s``s`ks``s``s`ks``s`kk`ks``s``s`ks``s``s`ks``s`kk`ks``s``s`ks`` s`kk`kk``s`kk`ks``s``s`ks``s``s`ks``s`kk`ks``s``s`ks``s``s`ks``s`kk`ks ``s``s`ks``s`kk`kk``s`kk`ks``s``s`ks``s``s`ks``s`kk`ks``s``s`ks``s`kk` kk``s`kk`kk``s``s`ks``s`kk`kk`ki``s``s`ks``s``s`ks``s`kk`ks``s``s`ks`` s`kk`kk``s`kk`kk``s`kk`ki``s``s`ks``s`kk`kk``s`kk`ki``s``s`ks``s`kk`kk `ki``s`kk`ki COMP 144 Programming Language Concepts Felix Hernandez-Campos

  6. Unlambda in Unlambda • http://www.ofb.net/~jlm/unlambda/unlambda.unl.gz COMP 144 Programming Language Concepts Felix Hernandez-Campos

  7. The Shocking Truth • “It's disgusting — it's revolting — we love it.” CyberTabloid • “Unlambda, the language in which every program is an IOUCC.” Encyclopædia Internetica • “The worst thing to befall us since Intercal.” Computer Languages Today • “The effect of reading an Unlambda program is like habing your brains smashed out by a Lisp sexp wrapped around an ENIAC. You won't find anything like it west of Alpha Centauri.” The Hitch-Hacker's Guide to Programming COMP 144 Programming Language Concepts Felix Hernandez-Campos

  8. Source of this evil • Reference • http://www.eleves.ens.fr:8080/home/madore/programs/unlambda/ • Extra credit • A+ guaranteed to the first one that develops a Turtle interpreter in Unlambda COMP 144 Programming Language Concepts Felix Hernandez-Campos

More Related