Skip to content

JagratPatkar/Lamb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dynamically Typed and interpreted Functional Programming Language, implemented in Ocaml. Lamb is a subset of the Lisp family of programming languages.

Features

Some of the basic features

  • Data Types
    • Int
    • Pair
    • List
  • Functional Idioms
    • Lambdas
    • Functions
    • Recursion
    • Closures
    • First Class Functions
    • Higher Order Functions
    • Currying
    • Let Expressions
  • Arithmetic Operations
    • Addition
    • Substraction

Examples

Church Encodings

;True 
(define TRUE x (lambda y x))


;False
(define FALSE x (lambda y y))


;Negation
(define NOT b (call (call b FALSE) TRUE))


;And or Conjunction
(define CONJUNCTION x 
                    (lambda y (call (call x y) FALSE)))


;Or / Disjunction
(define DISJUNCTION x 
                    (lambda y (call (call x TRUE) y)))
                    
                    
;Boolean Equality
(define BEQ x 
            (lambda y (call 
                        (call x (call (call y TRUE) FALSE)) 
                        (call x (call (call y FALSE) TRUE)))))

Map

(define map f (define helper xs 
                                (cmp (unit? xs) 0
                                     xs
                                     (pair (call f (car xs)) 
                                           (call helper (cdr xs)))))) 

About

λ Dynamically Typed, Interpreted Functional Programming Language

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages