include std/map.e
sequence argv=command_line()
integer m=map:new()
map:put(m,"0",argv[2])
this code crash when i run it
C:\euphoria-40\include\std\map.e:704 in procedure put()
type_check failure, map_data is 0
the_map_p = 1
the_key_p = {48'0'}
the_value_p = {67'C',58':',92'\',85'U',115's',101'e',114'r',115's',92'\',
74'J',97'a',99'c',113'q',117'u',101'e',115's',92'\',65'A',112'p',112'p',
68'D',97'a',116't',97'a',92'\',76'L',111'o',99'c',97'a',108'l',92'\',84'T',
101'e',109'm',112'p',92'\',101'e',117'u',83'S',104'h',84'T',101'e',109'm',
112'p',46'.',101'e',120'x',119'w'}
operation_p = 1
trigger_p = 23
index_ = <no value>
bucket_ = <no value>
average_length_ = <no value>
from_ = <no value>
map_data = 0
ret_ (from inlined routine 'calc_hash' at 38) = <no value>
max_hash_p (from inlined routine 'calc_hash' at 35) = <no value>
data = <no value>
msg (from inlined routine 'crash' at 308) = <no value>
msg (from inlined routine 'crash' at 336) = <no value>
tmp_seqk = <no value>
tmp_seqv = <no value>
msg (from inlined routine 'crash' at 623) = <no value>
msg (from inlined routine 'crash' at 947) = <no value>
... called from c:\users\jacques\appdata\local\temp\eushtemp.exw:6
Global & Local Variables
C:\euphoria-40\include\std\types.e:
Defined_Sets = {
{98'b',99'c',100'd',102'f',103'g',104'h',106'j',107'k',
108'l',109'm',110'n',112'p',113'q',114'r',115's',116't',118'v',119'w',120'x',
121'y',122'z',66'B',67'C',68'D',70'F',71'G',72'H',74'J',75'K',76'L',77'M',
78'N',80'P',81'Q',82'R',83'S',84'T',86'V',87'W',88'X',89'Y',90'Z'},
{97'a',101'e',105'i',111'o',117'u',65'A',69'E',73'I',
79'O',85'U'},
{
{48'0',57'9'},
{65'A',70'F'},
{97'a',102'f'}
},
{32' ',9,10,13,11,160},
{
{32' ',47'/'},
{58':',63'?'},
{91'[',96'`'},
{123'{',126'~'}
},
{
{32' ',126'~'}
},
{
{32' ',126'~'},
{32' ',32' '},
{9,9},
{10,10},
{13,13},
{8,8},
{7,7}
},
{
{97'a',122'z'}
},
{
{65'A',90'Z'}
},
{
{48'0',57'9'},
{97'a',122'z'},
{65'A',90'Z'}
},
{
{48'0',57'9'},
{97'a',122'z'},
{65'A',90'Z'},
{95'_',95'_'}
},
{
{97'a',122'z'},
{65'A',90'Z'}
},
{
{0,127''}
},
{
{0,31},
{127'',127''}
},
{
{48'0',57'9'}
},
{
{33'!',126'~'}
},
{
{0,255}
},
{95'_'},
{1,0}
}
C:\euphoria-40\include\std\machine.e:
FREE_ARRAY_RID = 1
page_size = 4096
kernel_dll = 1963655168
memDLL_id = 1963655168
VirtualAlloc_rid = 23
VirtualProtect_rid = 24
GetLastError_rid = 26
GetSystemInfo_rid = 27
vaa = <no value>
system_info_ptr = <no value>
oldprotptr = 37044280
C:\euphoria-40\include\std\convert.e:
mem = 37044312
decimal_mark = 46'.'
C:\euphoria-40\include\std\filesys.e:
InitCurDir = {67'C',58':',92'\',101'e',117'u',112'p',104'h',111'o',114'r',
105'i',97'a',45'-',52'4',48'0',92'\',119'w',111'o',114'r',107'k',92'\',119'w',
105'i',110'n',51'3',50'2',92'\',102'f',50'2',101'e',92'\'}
file_counters = {}
C:\euphoria-40\include\std\pretty.e:
pretty_end_col = <no value>
pretty_chars = <no value>
pretty_start_col = <no value>
pretty_level = <no value>
pretty_file = <no value>
pretty_ascii = <no value>
pretty_indent = <no value>
pretty_ascii_min = <no value>
pretty_ascii_max = <no value>
pretty_line_count = <no value>
pretty_line_max = <no value>
pretty_dots = <no value>
pretty_line_breaks = <no value>
pretty_printing = <no value>
pretty_fp_format = <no value>
pretty_int_format = <no value>
pretty_line = <no value>
C:\euphoria-40\include\std\serialize.e:
mem0 = 37044344
mem1 = 37044345
mem2 = 37044346
mem3 = 37044347
C:\euphoria-40\include\std\text.e:
lower_case_SET = {}
upper_case_SET = {}
encoding_NAME = {65'A',83'S',67'C',73'I',73'I'}
user32 = 1974075392
api_CharLowerBuff = 35'#'
api_CharUpperBuff = 36'$'
tm_size = 1024
temp_mem = 37901784
C:\euphoria-40\include\std\io.e:
mem0 = 37044376
mem1 = 37044377
mem2 = 37044378
mem3 = 37044379
C:\euphoria-40\include\std\get.e:
input_file = <no value>
input_string = <no value>
string_next = <no value>
ch = <no value>
leading_whitespace = <no value>
C:\euphoria-40\include\std\eumem.e:
ram_free_list = 1
free_rid = 6
C:\euphoria-40\include\std\primes.e:
list_of_primes = {2,3,5,7,11,13,17,19,23,29,31}
C:\euphoria-40\include\std\map.e:
threshold_size = 23
c:\users\jacques\appdata\local\temp\eushtemp.exw:
argv = {
{67'C',58':',92'\',101'e',117'u',112'p',104'h',111'o',114'r',
105'i',97'a',45'-',52'4',48'0',92'\',98'b',105'i',110'n',92'\',101'e',117'u',
105'i',46'.',101'e',120'x',101'e'},
{67'C',58':',92'\',85'U',115's',101'e',114'r',115's',92'\',
74'J',97'a',99'c',113'q',117'u',101'e',115's',92'\',65'A',112'p',112'p',
68'D',97'a',116't',97'a',92'\',76'L',111'o',99'c',97'a',108'l',92'\',84'T',
101'e',109'm',112'p',92'\',101'e',117'u',83'S',104'h',84'T',101'e',109'm',
112'p',46'.',101'e',120'x',119'w'}
}
m = 1
A map cannot be an integer. It must be an atom (or object). The reason for this is that the cleanup info is stored with the map to release the data when the map is dereferenced.
We could alternatively have an optional parameter that defaults to auto-cleanup, requiring the user to manually free the map's resources. So:
You should simply use the map type.