Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some additional list functions #844

Merged
merged 5 commits into from
Jan 21, 2017

Conversation

timdawborn
Copy link
Contributor

@timdawborn timdawborn commented Jan 19, 2017

Mirroring #830, this adds

  • reversing a list

The lists codegen unit tests pass in all five languages (once you remove the pre-exisiting PHP tests that are syntactically invalid).

var functionName = Blockly.Lua.provideFunction_(
'list_reverse',
['function ' + Blockly.Lua.FUNCTION_NAME_PLACEHOLDER_ + '(l)',
' local t = {}',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename these variables to be more descriptive.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I just copied the variable names that are used in all the other Lua functions in this file.

Copy link
Collaborator

@rachel-fenichel rachel-fenichel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One nit then lgtm

@timdawborn
Copy link
Contributor Author

Done.

@@ -1015,6 +1015,13 @@ Blockly.Msg.LISTS_SPLIT_TOOLTIP_SPLIT = 'Split text into a list of texts, breaki
/// https://github.com/google/blockly/wiki/Lists#make-text-from-list] for more information.
Blockly.Msg.LISTS_SPLIT_TOOLTIP_JOIN = 'Join a list of texts into one text, separated by a delimiter.';

/// url - Information describing reversing a list.
Blockly.Msg.LISTS_REVERSE_HELPURL = '';
/// Reverse a list of items %1.
Copy link
Contributor

@AnmAtAnm AnmAtAnm Jan 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"block text - Title of block that returns a copy of a list (%1) with the order of items reversed."

@@ -1015,6 +1015,13 @@ Blockly.Msg.LISTS_SPLIT_TOOLTIP_SPLIT = 'Split text into a list of texts, breaki
/// https://github.com/google/blockly/wiki/Lists#make-text-from-list] for more information.
Blockly.Msg.LISTS_SPLIT_TOOLTIP_JOIN = 'Join a list of texts into one text, separated by a delimiter.';

/// url - Information describing reversing a list.
Blockly.Msg.LISTS_REVERSE_HELPURL = '';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go ahead and fill this in as: https://github.com/google/blockly/wiki/Lists#reversing-a-list

When you submit, also make a new issue to create this wiki content. We can probably make you an editor for the wiki and would greatly appreciate help adding the docs for your new blocks there.

Unless you find a Wikipedia or similar description of reversing a list. That would be good, too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same applies for each of the new text blocks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can do.

Blockly.Msg.LISTS_REVERSE_HELPURL = '';
/// Reverse a list of items %1.
Blockly.Msg.LISTS_REVERSE_MESSAGE0 = 'reverse %1';
/// tooltip - See [https://github.com/google/blockly/wiki/Lists#reversing-a-list].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Until the wiki docs are created, this will not be sufficient for translators.

"tooltip - Short description for a block that reverses a copy of a list."

@timdawborn
Copy link
Contributor Author

timdawborn commented Jan 21, 2017

Requested rewordings have been made.

@AnmAtAnm AnmAtAnm merged commit 46316c7 into google:develop Jan 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants