Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standard library doesn't contain symbols #1

Open
Cypher1 opened this issue Jun 12, 2017 · 1 comment
Open

Standard library doesn't contain symbols #1

Cypher1 opened this issue Jun 12, 2017 · 1 comment

Comments

@Cypher1
Copy link

Cypher1 commented Jun 12, 2017

I thought it might be convenient to have symbols in Sheepda just to make the example code a bit more readable.

@Cypher1
Copy link
Author

Cypher1 commented Jun 12, 2017

Something like this might solve the problem.

# define symbols with names that have a change of not getting in the way of code people want to write
space = (num 0 3 2)
! = (succ space)
quot = (succ !)
hash = (succ quot)
dol = (succ hash)
perc = (succ dol)
amp = (succ perc)
apost = (succ amp)
open = (succ apost)
close = (succ open)
star = (succ close)
plus = (succ star)
comma = (succ plus)
dash = (succ comma)
dot = (succ dash)
/ = (succ dot)
_0 = (succ /)
_1 = (succ _0)
_2 = (succ _1)
_3 = (succ _2)
_4 = (succ _3)
_5 = (succ _4)
_6 = (succ _5)
_7 = (succ _6)
_8 = (succ _7)
_9 = (succ _8)
: = (succ _9)
; = (succ :)
< = (succ ;)
eq = (succ <)
> = (succ eq)
? = (succ >)
@ = (succ ?)
A = (succ @)
B = (succ A)
C = (succ B)
D = (succ C)
E = (succ D)
F = (succ E)
G = (succ F)
H = (succ G)
I = (succ H)
J = (succ I)
K = (succ J)
L = (succ K)
M = (succ L)
N = (succ M)
O = (succ N)
P = (succ O)
Q = (succ P)
R = (succ Q)
S = (succ R)
T = (succ S)
U = (succ T)
V = (succ U)
W = (succ V)
X = (succ W)
Y = (succ X)
Z = (succ Y)
[ = (succ Z)
back = (succ [)
] = (succ back)
^ = (succ ])
_ = (succ ^)
` = (succ _)
a = (succ `)
b = (succ a)
c = (succ b)
d = (succ c)
e = (succ d)
f = (succ e)
g = (succ f)
h = (succ g)
i = (succ h)
j = (succ i)
k = (succ j)
l = (succ k)
m = (succ l)
n = (succ m)
o = (succ n)
p = (succ o)
q = (succ p)
r = (succ q)
s = (succ r)
t = (succ s)
u = (succ t)
v = (succ u)
w = (succ v)
x = (succ w)
y = (succ x)
z = (succ y)


, = cons
] = nil

# Using these the fizzbuzz messages become more readable
fizzmsg = (, F (, i (, z (, z ]))))
buzzmsg = (, B (, u (, z (, z ]))))
fizzbuzzmsg = (, F (, i (, z (, z (, b (, u (, z (, z ]))))))))

# and the following program becomes valid
(print-list (, I (, space (, L (, I (, K (, E (, space (, S (, H (, E (, E (, P (, D (, A (, ! ]))))))))))))))))

Might also be nice to be able to infix an operator eventually, but I suppose that is not the lambda way
Thanks for Sheepda

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant