6
6
string_starts_with /2 , wrap_list /1 , string_ends_with /2 , string_pad /4 ,
7
7
uri_parse /1 , bit_array_slice /3 , percent_encode /1 , percent_decode /1 ,
8
8
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 ,
14
13
bit_array_to_int_and_size /1 , bit_array_pad_to_bytes /1 , index /2 , list /5 ,
15
14
dict /1 , int /1 , float /1 , bit_array /1 , is_null /1
16
15
]).
@@ -45,6 +44,8 @@ iodata_append(Iodata, String) -> [Iodata, String].
45
44
identity (X ) -> X .
46
45
47
46
classify_dynamic (nil ) -> <<" Nil" >>;
47
+ classify_dynamic (null ) -> <<" Nil" >>;
48
+ classify_dynamic (undefined ) -> <<" Nil" >>;
48
49
classify_dynamic (X ) when is_boolean (X ) -> <<" Bool" >>;
49
50
classify_dynamic (X ) when is_atom (X ) -> <<" Atom" >>;
50
51
classify_dynamic (X ) when is_binary (X ) -> <<" String" >>;
@@ -53,17 +54,17 @@ classify_dynamic(X) when is_integer(X) -> <<"Int">>;
53
54
classify_dynamic (X ) when is_float (X ) -> <<" Float" >>;
54
55
classify_dynamic (X ) when is_list (X ) -> <<" List" >>;
55
56
classify_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" >>;
58
61
classify_dynamic (X ) when
59
62
is_function (X , 0 ) orelse is_function (X , 1 ) orelse is_function (X , 2 ) orelse
60
63
is_function (X , 3 ) orelse is_function (X , 4 ) orelse is_function (X , 5 ) orelse
61
64
is_function (X , 6 ) orelse is_function (X , 7 ) orelse is_function (X , 8 ) orelse
62
65
is_function (X , 9 ) orelse is_function (X , 10 ) orelse is_function (X , 11 ) orelse
63
66
is_function (X , 12 ) -> <<" Function" >>;
64
- classify_dynamic (_ ) -> <<" Some other type" >>.
65
-
66
- size_of_tuple (Data ) -> tuple_size (Data ).
67
+ classify_dynamic (_ ) -> <<" Unknown" >>.
67
68
68
69
tuple_get (_tup , Index ) when Index < 0 -> {error , nil };
69
70
tuple_get (Data , Index ) when Index >= tuple_size (Data ) -> {error , nil };
0 commit comments