renciso218 / blockly

Automatically exported from code.google.com/p/blockly
0 stars 0 forks source link

Equip List with Stack's ability. #38

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Trying to implement some algorithm in Blockly, I found out that the list has no 
ability of stack.

For my quick hack. I use mathematics + symbol for joining lists and render it 
in Python, but this doesn't work when render in JavaScript (I haven't try Dart 
yet).

This happen because JS convert lists into string then concat it. So the output 
from list + list is string.

My other approach for JS is to creating a counter, store length of the list to 
it, increasing it by 1, and setting new item at that counter. Of cause, this 
doesn't work in Python.

Popping item out of the list also difficult too. I have to create empty temp 
list then looping for every item except the last one (Python). Or decreasing 
the counter by 1, so the last item I should get will not be the last item 
stored (JS).

Original issue reported on code.google.com by neizod on 15 Jun 2012 at 11:10

GoogleCodeExporter commented 8 years ago
Lists and strings (both sequence data types) have a lot of missing functions.  
We halted block creation when we realized that each would require dozens of 
blocks in order to provide coverage of basic operations.  Blockly is supposed 
to be simple for the user and we don't want to assault them with an avalanche 
of blocks.

We are working to make the block specification more powerful so that we can do 
something similar in capability to Python's awesomely flexible slice syntax.

Original comment by neil.fra...@gmail.com on 18 Jun 2012 at 9:04

GoogleCodeExporter commented 8 years ago
Too many blocks is a problem that hierarchical cascading context-sensitive 
block insertion menus can solve. Scrolling down the block list sidebar is no 
fun.

Original comment by jsals...@gmail.com on 19 Jun 2012 at 1:26

GoogleCodeExporter commented 8 years ago
Sorry for the delay, we had a lot of infrastructure work to do before we could 
get back to designing new blocks.

Lists now have pop and shift (amongst many other new functions).  Push and 
unshift are coming soon.

Original comment by neil.fra...@gmail.com on 5 Jan 2013 at 8:27

GoogleCodeExporter commented 8 years ago
Push, pop, shift, unshift, get, set, insert, remove, sublist, all done.  Did I 
forget anything?

Committed to the repository, will go live in the next push.

Original comment by neil.fra...@gmail.com on 4 Mar 2013 at 6:53