functional programming - Extract only the number from a ref in erlang -


i'm new erlang. need take number returned make_ref(). so, if make_ref() returns :#ref<0.0.0.441> extract 441.

any idea how this?

try instead:

unique_integer() ->     try         erlang:unique_integer()     catch         error:undef ->             {ms, s, us} = erlang:now(),             (ms*1000000+s)*1000000+us     end. 

edit: main difference between solution , extracting integer using io_lib:format("~p", [ref]) speed. when solution takes around 40ns in r18, transformation list, regexp , integer takes 9µs. go 2 orders of magnitude faster solution.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -