Merged
Conversation
thautwarm
reviewed
Jun 28, 2020
| def ap(end): | ||
| step = 1 if start <= end else -1 | ||
| return list(_buitins["range"](start, end + step, step)) | ||
| return tuple(_buitins["range"](start, end + step, step)) |
Member
There was a problem hiding this comment.
_builtins["range"] is very slow. please directly load range instead. You can give an alias to range in global context, like
_glob = global.
|
|
||
|
|
||
| replicate = lambda count: lambda value: [value for _ in _buitins["range"](count)] | ||
| replicate = lambda count: lambda value: tuple([value for _ in _buitins["range"](count)]) |
Member
There was a problem hiding this comment.
do not bind lambda to variable, use def.
also, avoid _builtins["range"].
| @@ -37,7 +37,7 @@ def listToArray(lst): | |||
| while xs is not None: | |||
| result.append(xs.head) | |||
Member
There was a problem hiding this comment.
result_app = result.append
for ...:
result_app(xs.head)| length = lambda xs: len(xs) | ||
|
|
||
| cons = lambda e: lambda l: [e, *l] | ||
| cons = lambda e: lambda l: (e, *l) |
| return just(tuple(ll)) | ||
|
|
||
|
|
||
| _insertAt = lambda just: lambda nothing: lambda i: lambda a: lambda l: _insertAtImpl( |
| return just(tuple(ll)) | ||
|
|
||
|
|
||
| _updateAt = lambda just: lambda nothing: lambda i: lambda a: lambda l: _updateAtImpl( |
| def concat(xss): | ||
| result = [] | ||
| for x in xss: | ||
| result.extend(x) |
Member
There was a problem hiding this comment.
bind extend = result.extend outside the loop.
There're a lot of same places you'd follow my above review to change
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
trying to fix:
purescript-python/purescript-prelude.py#2