You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to RapydScript
I thought it was the case that tuples are always converted to lists, but not in this (admittedly unusual) case:
d = {}
d[(1,2)] = 'cat'
d[(3,4)] = 'dog'
transpiles to
d = { };
d[[1,2,]] = "cat";
d[3, 4] = "dog"; // note that [(3,4)] has been converted to [3,4]
This bug is present in the newest RS as well as in earlier versions.
Bruce
Alexander Tsepkov
unread,
Nov 9, 2015, 1:51:50 AM11/9/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Bruce Sherwood, RapydScript
Ah yes, you're correct about the last case. I will take a look at it. However, you're saying that d[(1,2)] compiles to d[[#,#]], and d[(3,4)] does not? I'm seeing them both compile to d[#,#], and in fact that's what I'd expect - there is nothing in second case that would cause the tokenizer engine to interpret the two differently and I'd be concerned if it did. Are you sure there wasn't a typo? This is what I'm seeing for compiled output:
var d;
d = {};
d[1,2] = "cat";
d[3,4] = "dog";
Bruce Sherwood
unread,
Nov 9, 2015, 12:40:43 PM11/9/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Alexander Tsepkov, RapydScript
You're right -- there's an unfortunate typo in my input code, which was supposed to read like this:
d = { };
d[ [1, 2] ] = "cat";
d[ (3, 4) ] = "dog";
which transpiles as I said to
d = { };
d[[1,2,]] = "cat";
d[3, 4] = "dog";
Sorry for the confusion!
Bruce
I'm reminded of the wonderful Monty Python skit in which an auditioning singer sings "You say tomatoes and I say tomatoes, you say potatoes and I say potatoes; tomatoes/tomatoes, potatoes/potatoes, let's call the whole thing off", in which he pronounces the supposedly different pairs exactly the same. Eventually he stops and says, "I don't see what their problem is!"
Bruce Sherwood
unread,
Nov 12, 2015, 8:32:33 PM11/12/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to RapydScript, atse...@gmail.com
Here's a simpler case:
a = ((1,2), (5,2), (8,4)) # compiles to a = [1,2,5,2,8,4,]; but presumably should be [[1,2], [5,2], [8,4],]
b = [(1,2), (5,2), (8,4)] # compiles to b = [[1,2,],[5,2,],[8,4,],];