Tag-Archive for » language «

Tuesday, October 28th, 2008 | Author:

For the past few days, I have been slaving away working on my latest creation: FANG, a programming language that I’m hoping will combine some of the best features I’ve found in my studies and remove some of the cruft. It will have scheme/lisp like syntax and Erlang like processes, and some other neat features from other languages I’ve come across. After this weekend, I have a rough start which supports variables, lambda functions, and auto-memoizing clean functions. You can download the source from SVN (username = password = anonymous) and check it out. Please feel free to comment with features to add, or things to change.

Features I want FANG to have:

  • Clean scheme/lisp syntax and macros
  • Lightweight processes and multi-node support
  • Arbitrary precision number support
  • Process jailing and permission setting
  • Simple networking and file I/O
  • Others I’m sure I forgot…

Code Examples:

  • (defvar ‘fib (lambda ‘(n) ‘(if (< n 3) (1) (+ (fib (- n 1)) (fib (- n 2)))))) – A plain recursive function that automatically will get memoized, so it’s rather speedy (use dirty-lambda to turn off the memoization)
  • (defvar ‘max (lambda ‘(a b) ‘(if (> a b) (a) (b)))) – A simple max function used in findset
  • (defvar ‘findset (lambda ‘(l) ‘(if (== (length l) 0) 0 (if (== 1 (length l)) (hd l) (max (+ (hd l) (if (== 2 (length l))) 0 (findset (tl (tl l)))) (findset (tl l))))))) – A function for a homework assignment to find the highest weighted independent set in a path
  • (defvar ‘fact (lambda ‘(n) ‘(if (== 0 n) (1) (* n (fact (- n 1)))))) – A memoized factorial function

Peace and chow,

Ranok