COMP 144 Programming Language Concepts - PowerPoint PPT Presentation

About This Presentation
Title:

COMP 144 Programming Language Concepts

Description:

COMP 144 Programming Language Concepts Spring 2002 Lecture 28: More on Functional Programming Felix Hernandez-Campos April 1 Advanced Functional Programming ... – PowerPoint PPT presentation

Number of Views:41
Avg rating:3.0/5.0
Slides: 9
Provided by: FelixHern
Learn more at: http://www.cs.unc.edu
Category:

less

Transcript and Presenter's Notes

Title: COMP 144 Programming Language Concepts


1
Lecture 28 More on Functional Programming
The University of North Carolina at Chapel Hill
  • COMP 144 Programming Language Concepts
  • Spring 2002

Felix Hernandez-Campos April 1
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-eliminati
    on

3
Programming Principles
  • Seven primitive functions
  • k,
  • s,
  • i,
  • v,
  • d,
  • C, and
  • .x

4
Numbers
  • Church integers
  • lt0gt is fxx (i.e. ki).
  • lt1gt is fxfx (i.e. i).
  • lt2gt is fxffx (i.e. sskski).
  • lt3gt is fxfffx (i.e. ssksksskski
    ).
  • and so on

5
Example Fibonacci
  • The following Unlambda program calculates and
    prints the Fibonacci numbers (as lines of
    asterisks)
  • sssiiskkkikissksssksskkk
    sssksssks
  • skkksssksssksskkksssksss
    ksskkksssk
  • sskkkkskkkrssksssksskkkss
    sksssksskk
  • ksssksskkkkkissksskkkkskkk
    .ssksskkkk
  • skkissksskkkkskkiskkkissks
    ssksskkks
  • ssksssksskkksssksskkkkskk
    kssksssks
  • skkksssksssksskkksssksskk
    kkskkksssk
  • sssksskkksssksssksskkkss
    sksskkkkskk
  • ksssksssksskkksssksskkkk
    skkkksskss
  • kkkkskkissksssksskkksssks
    skkkkskkkks
  • kkkissksssksskkksssksssks
    skkksssks
  • skkkkskkksssksssksskkksss
    ksssksskkks
  • ssksskkkkskkkssskssskssk
    kksssksskk
  • kkskkkkssksskkkkkissksssks
    skkksssks
  • skkkkskkkkskkkissksskkkkskk
    kissksskkkk
  • kiskkki

6
Unlambda in Unlambda
  • http//www.ofb.net/jlm/unlambda/unlambda.unl.gz

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

8
Source of this evil
  • Reference
  • http//www.eleves.ens.fr8080/home/madore/programs
    /unlambda/
  • Extra credit
  • A guaranteed to the first one that develops a
    Turtle interpreter in Unlambda
Write a Comment
User Comments (0)
About PowerShow.com