cwells / franz Goto Github PK
View Code? Open in Web Editor NEWSimple expression-oriented language written in Python
License: MIT License
Simple expression-oriented language written in Python
License: MIT License
fibonacci-sequence = fn (n: int) {
a = b = 1
for i in 3 to n + 2 {
yield a
(a, b) = (b, a + b)
}
}
doesn't parse, but,
fibonacci-sequence = fn (n: int) {
a = b = 1
for i in 3 to n + 2 {
yield (a)
(a, b) = (b, a + b)
}
}
is fine. It appears that yield a(a, b)
is what is being evaluated. Not sure if this is "fixable" or if the ambiguity will need to be resolved by the user.
The current form ( name: type ("," name: type)* )
doesn't allow for default values.
Proposed solution: ( type name ("=" default)* ("," type name ("=" default)*)* )
e.g. (int i, int j=10)
Will need to trap this to prevent assignment from taking over (or continue using ":" rather than "=").
a[i] = j
doesn't work.
Given the following three functions
a = fn (n: int)
for i in 1 to n
yield i;
b = fn (iter: any)
for j in iter
yield j;
c = fn (iter: any)
for k in iter
yield k;
evaluating [ a(5) ]
works as expected:
[1, 2, 3, 4, 5]
.
Conversely, result of evaluating [ c(b(a(5)) ]
:
[1, 2, (), (), (), 3, (), (), (), 4, (), (), (), 5, (), (), (), 5, (), ()]
When nesting the functions, [ c(b(a(5))) ]
, instead of seeing the call chain a->b->c->a->b->c
we see a->b->c->a->c
. Further testing has shown that whatever number of functions is nested, it always jumps from first function to last function on the second iteration. As such, [ a(5) ]
works because this is the special case where first == last. It "works" due to accidentally switching back to the correct coroutine.
Further, when this happens, the last function has its loop variable (i, j, k) set to the empty tuple ()
. This happens to coincide with the value returned from greenlet.switch()
when it is called on a dead coroutine (it may also indicate other conditions, I'm not certain) ๐ค.
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.