paulsonkoly / calc Goto Github PK
View Code? Open in Web Editor NEWSmall functional language implemented in go
License: MIT License
Small functional language implemented in go
License: MIT License
it would be useful to be able to debug calc with a repl started at a given point in the program. A new built in function repl() would start a repl in the context of the call. When the repl exits the execution of the original script resumes. One can print values of variables and with that debug calc.
As the repl would be a function, it would be running its own frame so variable writes from it would be lost when it returns. Also its return value should be no value error, same as a loop value that never entered the loop body.
It would be useful to support string type.
String operations would be the same as array operations. (indexing and concatenation)
At this point the builtin read function should be re-thought. It probably should just return a string, and we should add builtin functions for type conversions as more built in functions between strings and non strings.
a = read()
a = atoi(a)
It could be useful for the user to create it's own error type. Probably only becomes useful if strings are supported.
New built in function error takes a string (error message) and returns an error.
f = (n) -> if n == 0 error("whoops") else 10/n
In order to be more useful calc should support array type.
At the minimum array type should have the following concepts:
The syntax could be whats implied by the following example:
filter = (pred, ary) -> {
i = 0
r = []
while i < #ary {
if pred(ary@i) r = r + [ary@i]
i = i + 1
}
r
}
qsort = (ary) -> {
if #ary == 0 ary else {
pivot = ary@0
qsort(filter((n) -> n <= pivot), ary@1:)) + [pivot] + qsort(filter((n) -> n > pivot, ary@1:))
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.