Skip to content

TheUnlocked/FAI-Language

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About FAI

FAI (or FAI lang) stands for Functional Alegbraic, and Interpreted language, and that's what it strives to be. FAI is a purely functional language with algebraic syntax. That said, FAI is not just a functional calculator. While FAI borrows syntax from algebra, it in itself is not algebra, and the user must implement any non-basic algebraic functions. For example, if one wanted to solve a trinomial, they could implement the quadratic formula.

x = \frac{-b \pm \sqrt{b^{2}-4ac}}{2a}
quadratic(a, b, c) = (-b +- sqrt(b^2 - 4a*c)) / 2a
\text{for} \;\; x^2-x-2=0, \;\; x=\frac{-1 \pm \sqrt{1^{2}-4\cdot 1\cdot -2}}{2\cdot 1}=2,-1
quadratic(1, -1, -2)
> (2 | -1)

Purpose

Other programming languages, especially functional ones, may look intimidating or confusing to new programmers. For example, this scheme code:

(define (factorial x)
	(if (= x 1) 1 (* x (factorial (- x 1)))))

A programmer familiar with Scheme (or another LISP-like language) might have no problem reading that, but to someone with no exposure to programming, how would they know what's going on there? Compare that to the FAI code:

factorial(x) = {1 if x = 1; x * factorial(x - 1) otherwise;

That's already much more readable to someone who knows algebra but after being processed through TeXiFAI, a FAI TeXer (on hold until grammar is finalized), that function could be automatically represented like this:

\text{factorial}(x)= \begin{cases} 1 & \text{if} \; x = 1; \\ x \cdot \text{factorial}(x-1) & \text{otherwise}; \end{cases}

Connecting that to the algebraic notation isn't hard, because it is the algebraic notation.

So as a complete answer to what the purpose of FAI is, FAI exists to serve as a programming language that allows for teaching a functional paradigm within the comfort of algebraic syntax.

Specification

A draft specification is currently being worked on at the wiki page.

Plans

For plans with language features, look in the issues tab. If you have an idea, feel free to open up a new issue with your proposal.

Other plans

  • Finish TeXiFAI, a FAI TeXer
  • Create FAIDE, a FAI IDE

About

The repo for the FAI programming language

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages