66 string_starts_with /2 , wrap_list /1 , string_ends_with /2 , string_pad /4 ,
77 uri_parse /1 , bit_array_slice /3 , percent_encode /1 , percent_decode /1 ,
88 base_decode64 /1 , parse_query /1 , bit_array_concat /1 ,
9- bit_array_base64_encode /2 , size_of_tuple /1 ,
10- tuple_get /2 , classify_dynamic /1 , print /1 , println /1 , print_error /1 ,
11- println_error /1 , inspect /1 , float_to_string /1 , int_from_base_string /2 ,
12- utf_codepoint_list_to_string /1 , contains_string /2 , crop_string /2 ,
13- base16_encode /1 , base16_decode /1 , string_replace /3 , slice /3 ,
9+ bit_array_base64_encode /2 , tuple_get /2 , classify_dynamic /1 , print /1 ,
10+ println /1 , print_error /1 , println_error /1 , inspect /1 , float_to_string /1 ,
11+ int_from_base_string /2 , utf_codepoint_list_to_string /1 , contains_string /2 ,
12+ crop_string /2 , base16_encode /1 , base16_decode /1 , string_replace /3 , slice /3 ,
1413 bit_array_to_int_and_size /1 , bit_array_pad_to_bytes /1 , index /2 , list /5 ,
1514 dict /1 , int /1 , float /1 , bit_array /1 , is_null /1
1615]).
@@ -45,6 +44,8 @@ iodata_append(Iodata, String) -> [Iodata, String].
4544identity (X ) -> X .
4645
4746classify_dynamic (nil ) -> <<" Nil" >>;
47+ classify_dynamic (null ) -> <<" Nil" >>;
48+ classify_dynamic (undefined ) -> <<" Nil" >>;
4849classify_dynamic (X ) when is_boolean (X ) -> <<" Bool" >>;
4950classify_dynamic (X ) when is_atom (X ) -> <<" Atom" >>;
5051classify_dynamic (X ) when is_binary (X ) -> <<" String" >>;
@@ -53,17 +54,17 @@ classify_dynamic(X) when is_integer(X) -> <<"Int">>;
5354classify_dynamic (X ) when is_float (X ) -> <<" Float" >>;
5455classify_dynamic (X ) when is_list (X ) -> <<" List" >>;
5556classify_dynamic (X ) when is_map (X ) -> <<" Dict" >>;
56- classify_dynamic (X ) when is_tuple (X ) ->
57- iolist_to_binary ([" Tuple of " , integer_to_list (tuple_size (X )), " elements" ]);
57+ classify_dynamic (X ) when is_tuple (X ) -> <<" Array" >>;
58+ classify_dynamic (X ) when is_reference (X ) -> <<" Reference" >>;
59+ classify_dynamic (X ) when is_pid (X ) -> <<" Pid" >>;
60+ classify_dynamic (X ) when is_port (X ) -> <<" Port" >>;
5861classify_dynamic (X ) when
5962 is_function (X , 0 ) orelse is_function (X , 1 ) orelse is_function (X , 2 ) orelse
6063 is_function (X , 3 ) orelse is_function (X , 4 ) orelse is_function (X , 5 ) orelse
6164 is_function (X , 6 ) orelse is_function (X , 7 ) orelse is_function (X , 8 ) orelse
6265 is_function (X , 9 ) orelse is_function (X , 10 ) orelse is_function (X , 11 ) orelse
6366 is_function (X , 12 ) -> <<" Function" >>;
64- classify_dynamic (_ ) -> <<" Some other type" >>.
65-
66- size_of_tuple (Data ) -> tuple_size (Data ).
67+ classify_dynamic (_ ) -> <<" Unknown" >>.
6768
6869tuple_get (_tup , Index ) when Index < 0 -> {error , nil };
6970tuple_get (Data , Index ) when Index >= tuple_size (Data ) -> {error , nil };
0 commit comments