Page 1 of 2
Map with integer key
Posted: Sat Jun 01, 2019 3:27 pm
by Thorsten1867
It would be very helpful if there were also a MAP where you could use integers as keys.
Re: Map with integer key
Posted: Sat Jun 01, 2019 3:53 pm
by Little John
+ 1
Re: Map with integer key
Posted: Sat Jun 01, 2019 5:18 pm
by Josh
+1
Re: Map with integer key
Posted: Sat Jun 01, 2019 5:39 pm
by Bisonte
Thorsten1867 wrote:It would be very helpful if there were also a MAP where you could use integers as keys.
Very, very, very, very, very....... helpful
+1
Re: Map with integer key
Posted: Sun Jun 02, 2019 12:15 am
by Andre
+1
Currently I'm using maps most of the time with unique ID numbers as map key.
But always need to convert them to ID strings first, which could be avoided if this wish come true

Re: Map with integer key
Posted: Sun Jun 02, 2019 5:08 am
by davido
+1
Re: Map with integer key
Posted: Sun Jun 02, 2019 6:36 am
by BarryG
+1
Re: Map with integer key
Posted: Sun Jun 02, 2019 9:04 am
by RSBasic
+1
I always use Str(IntValue) because this is not possible otherwise.
Re: Map with integer key
Posted: Sun Jun 02, 2019 9:19 am
by Mijikai
+ 1
How about:
Code: Select all
;Create a map based on #PB Type:
NewMap Country.s(#PB_Integer)
NewMap Country.s(#PB_Float)
NewMap Country.s(#PB_Byte)
NewMap Country.s(#PB_Double)
;...
;-> MapType() -> returns the Type
Re: Map with integer key
Posted: Sun Jun 02, 2019 9:24 am
by RSBasic
Or:
Code: Select all
NewMap.i Country.s()
Country(1) = "Germany"
Re: Map with integer key
Posted: Sun Jun 02, 2019 3:18 pm
by Demivec
Or:
Code: Select all
;Create a map of either String or Integer type, #PB_Default used for slots = 512 and for type = #PB_String
NewMap name.<type>([Slots | #PB_Default [, #PB_String | #PB_Integer | #PB_Default]])
MapType(Map()) -> returns either #PB_String or #PB_Integer

Re: Map with integer key
Posted: Tue Jun 04, 2019 2:17 pm
by Tenaja
I think you are asking for something like this, to use in the meantime:
viewtopic.php?f=13&t=58708
Re: Map with integer key
Posted: Sun May 30, 2021 2:56 am
by Rinzwind
+1
Any official statement?
Re: Map with integer key
Posted: Sun May 30, 2021 8:07 am
by idle
no but you can use the numeric functions of squint for that.
viewtopic.php?f=12&t=75783
Re: Map with integer key
Posted: Sun May 30, 2021 2:03 pm
by Tenaja
Rinzwind wrote: Sun May 30, 2021 2:56 am
+1
Any official statement?
I, too, would like this feature... However...
Consider their focus at the moment: it's fully on the alpha release. My bet is that if you do get a reply, it will be something like "we may evaluate new features after the C backend is released".
It's not really reasonable to think they are going to put the alpha release on hold to add a feature request that is two years old... Especially when there are at least two libraries on the forum that do what you have asked for.
Has Fred written in any threads not related to the alpha this month?