Added list comprehensions and standard List, Option, Func, Pair, and Triple library #596
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "github/fork/radrow/list-comprehension"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Created by: radrow
New syntax
Example test file
Standard library
Standard libraries are included automatically. They take priority over user defined files and any attempt to redefine them will lead to an error.
Developing
They are written as inlined strings in
aeso_stdlib.erl
, however in the future they should (IMO) be kept as separateaes
files and at best compiled during aesophia build time.If standard library wants to import another one it just needs to be mentioned in
dependencies/1
function. The keywordinclude
should not be used in stdlib code.To preserve compatibility with existing tests all functions in stdlib should have explicitly defined types.
Other changes
expand_includes
inaeso_parse
has yet another argument –Included
which is a set of already included files that are going to be skipped. They are encoded as pairs of their filenames and hashes of their contents. This solution solves most problems with cyclic and transitive imports and allows to safely mix them up.This argument is also included in
parse
inaeso_compiler
.I have added one more compiler option –
no_implicit_stdlib
which stops standard library being included automatically. This helps a bit with includes inside of the stdlib and fixes compatibility issues of already existing tests that didn't expect additional includes and is very handy in tests that just don't require stdlib which has really bad impact on overall compilation performance (it increases build time by about 1 second of a single contract on my PC).TODO
erl
files++[f(x) | x <- l]
could be replaced byLists.map
Created by: UlfNorell
A perhaps nicer alternative is to import it implicitly.
We have no machinery for separate compilation and I don't see that there would be any tangible benefits from it.
Created by: UlfNorell
Is this type no longer valid?
Created by: UlfNorell
🤨
Created by: UlfNorell
This isn't right.
iter(2 ^ n, f) == f
. You want the recursive call to beHowever I don't think this is really a function that we should put in the standard libarary.
Created by: UlfNorell
is_empty
?Created by: UlfNorell
head
?Created by: UlfNorell
To make these
option
-valued functions convenient to use, we should should also have some standard functions on options (but let's leave that for another PR)Created by: UlfNorell
We probably want short-cut behaviour for these.
Created by: radrow
emacs for the win :p fixed
Created by: radrow
undeleted
Created by: radrow
What do you mean?
Created by: radrow
That's good idea. Maybe we should start an issue for it?
Created by: radrow
I know your point, but imo
first
will look more clear for a random userCreated by: radrow
fixed
Created by: radrow
My bad, sorry, fixed. I believe it can be used in some iterative algorithms and we don't gain much if we remove it
Created by: radrow
Maybe I should consider cases of
comprehension_bind
andcomprehension_if
, @UlfNorell what do you think?Created by: radrow
I have added some support
Created by: radrow
Tests are radically longer because all that code needs to be processed every time. On the other hand I have provided option to skip stdlib – we may use it in tests that don't use it
Created by: UlfNorell
That
all
only evaluatesp
until it gets afalse
, in the same way thatfalse && x
doesn't evaluatex
.Created by: radrow
fixed
Created by: UlfNorell
Review: Approved
Created by: hanssv
Review: Approved
Looks great!
Merged by: hanssv at 2019-08-14 11:53:58 UTC