Created
May 9, 2021 17:10
-
-
Save nkezhaya/f63c3374cfddd2b5c251e6c83b671321 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def copy_into(destination, src, destination_offset \\ 0, start_index \\ 0) do | |
| destination = :binary.bin_to_list(destination) | |
| {prefix, destination} = :lists.split(destination_offset, destination) | |
| src = :binary.bin_to_list(src) | |
| {_, src} = :lists.split(start_index, src) | |
| {_replaced, destination} = :lists.split(length(src), destination) | |
| :binary.list_to_bin(prefix ++ src ++ destination) | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment