GitHub - metazip/pointfrip: pointfree interpreter with instance variables and classes, in lazarus

GitHub

2 min read Original article ↗

[McJones] History of John Backus's functional programming project

pointfrip

pointfree interpreter with instance variables and classes, in lazarus

screenshot

Function-level Programming like FP from John Backus

ip ≡ (+ \) ° (* aa) ° trans ° ee
eq0  ≡ id=0
sub1 ≡ id-1
fact ≡ eq0 → 1; id*fact°sub1

for example: generation of numbers with iota

iota == [1]°((ispos°[0])->*(pred°[0]),([0],[1]),)°id,(),
iota ° 10
--> (1 ; 2 ; 3 ; 4 ; 5 ; 6 ; 7 ; 8 ; 9 ; 10 ;)

possibility to work with tables/instance-variables like in trivia

(#beta & #alpha & #gamma & #delta & "US") ° (delta:="K") ° '("A" alpha "B" beta "C" gamma)
--> "BACKUS"

defining classes and using objects

constr == .. { object
               [head] == head ° pop
               [tail] == tail dip
               [comma] == (top°[0]) obj [1],pop°[0]
               [reverse] == reverse dip  // method
             }
--> ( )

reverse ° (constr :: A;B;C;)             // reverse == [reverse] fn ...
--> (constr :: C ; B ; A ;)

side-effects used in installer.exe

((#draco loadtext)°(draco:=corepath & "drache.pf") eff 'io)>>(it showinfo)>>(#draco run)>>()

meta-programming: you can also create your own combining forms like in Backus FFP

quoteit == top°term

(a quoteit)
--> a

twice == (top°term) app (top°term) app arg

((id+1) twice) ° 5
--> 7

while == ((top°term) app arg)->(term app (pop°term) app arg);arg

head°((isprop°tail) while tail) ° (a;b;c;d;e;)
--> e

WHERE Clause with Instance Variables

sumtrisqinc == ( #sum app (([1] app [0]) aa0)
               ° (#co app #inc app it) ee #square )
      where (  sum == + \
               co == id,id,id,
               square == id*id
               inc == id+1  )

sumtrisqinc°10
--> 363

Duplicate definitions with identical code are not flagged as errors.

Limited API support: httpget and parsejson for reading APIs. (Version-20240701)

Example
Reference.pdf
Quickinfo.pdf
Website

Getting Startet ...


heise Download
Virus checked with 40 virus scanners from heise.de
If you like pointfrip you can download and use it.

Can you write any function in point-free notation?

friedbrice

This is a Red language: Closed applicative languages