r/ProgrammingPals • u/omkarjc • Mar 23 '20
Help in Developing an Intentional Programming Language
Creating a language where you just type out your intention
example:
print 1 to 10 # Prints 1,2,3....
print 5 C 2 # Prints 10
a = ["a","b","c","d"]
0 th a # Prints "c"The first executable version is ready here (it's a little buggy).
The idea is that you can create user-defined operators like "to" or "C" or "th" (They exist in the current version)
The operators act like functions but the parameters can be passed on both sides of the function.
Please DM me if anyone is inerested or just start contributing here on Github
2
u/teh_trickster Mar 23 '20
Check out ‘infix’ operators in Haskell, and ‘fixity’.
It sounds like you would like Haskell.
1
u/omkarjc Mar 24 '20
The syntax in Haskell is really ehh In proxima the syntax is almost pythonic and English like
1
u/jcode777 Mar 24 '20
Check out function programming and haskell :)
The motto is, you don't say "how" something is to be done. You say "what" has to be done.
Oh and haskell (a functional programming language) has ability to define custom operators!
1
u/omkarjc Mar 24 '20
The difference here is that syntax is really straight forward and readable almost pythonic .that's the entire point of an intentional language.
3
u/pilotInPyjamas Mar 24 '20
This sounds really similar to Haskell actually. I used your tutorial on GitHub as an example:
import Control.Monad
-- some helper functions
th = flip (!!)
st = flip (!!)
nd = flip (!!)
rd = flip (!!)
main = do
-- python like indentation
when (5 > 2) $
print "five is greater than 2"
-- Some basic types
let x = 10
let x = 10.9
let x = "Heyo!"
let x = True
let x = False
-- lists
let x = [1, 2, 3]
let x = 1: 2: 3: 4: 5: 6: []
-- printing and list access
print $ 0 `th` x
print $ 1 `st` x
print $ 2 `nd` x
-- length
print $ length x
-- conversion to string
let x = "10"
print $ read x + 10
-- conversion from string
let y = 20
print $ "String: " ++ show y
-- 'if' statement. 'when' is actually just a regular function
let x = 5
when (x > 9) $
print("Hey")
-- pattern matching
let y = 11
case y of
11 -> print "Equal to 10"
_ -> print "Not equal to 10"
-- define a factorial
let fac 0 = 1
fac x = x * fac (x - 1)
-- define your own operator
n `c` r = fac n / (fac (n - r) * fac r)
print $ 5 `c` 21
2
u/Drag0nV3n0m231 Mar 23 '20 edited Mar 23 '20
Isn’t that what the point of object-oriented programming is??