The Design and Implementation of the Self Compiler (1992) [pdf]
cs.tufts.edu2 pointsby kbp0 comments
def main():
x = 2
[x] = ["foo"]
y = 3
[y] = ["bar"]
print(x + y)
Seems about the same level of comprehensibility to me. Is there anything in particular you find difficult to understand? main = do
let x = 2
let x = "foo"
y <- pure 3
y <- pure "bar"
putStrLn $ x ++ y
which is really the same as main =
let x = 2
in let x = "foo"
in pure 3 >>= \y ->
pure "bar" >>= \y ->
putStrLn $ x ++ y
So it works pretty naturally where each assignment is kind of like a new scope. If the type system is good, I don't think it really causes issues. irb(main):001:1/ puts(%r
irb(main):002:1* a+
irb(main):003:0> .match? %q aaa )
true def
foo(x)
bar(x)
end
as an example of Ruby syntax being overly homogeneous. sumTree :: BTree -> Int
sumTree t = sumTree' [t] 0
where sumTree' [] total =
total
sumTree' (Leaf v : rest) total =
sumTree' rest (v + total)
sumTree' (Branch v l r : rest) total =
sumTree' (l : r : rest) (v + total)
Sorry, I didn't re-read the code before translating.