Skip to content

arrayutils: splitModulo and concatAModulo are made total#1194

Open
dmitry-vlasov wants to merge 3 commits into
masterfrom
arrayutils_split_concat_modulo
Open

arrayutils: splitModulo and concatAModulo are made total#1194
dmitry-vlasov wants to merge 3 commits into
masterfrom
arrayutils_split_concat_modulo

Conversation

@dmitry-vlasov
Copy link
Copy Markdown
Contributor

No description provided.

@dmitry-vlasov dmitry-vlasov requested a review from shkel April 26, 2023 15:17
Copy link
Copy Markdown
Contributor

@shkel shkel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how many times are these functions used? (splitModulo and concatAModulo).
if no one uses them (1-2 times), then they should not be in the library at all. Why they are needed and what they do is also unclear.

Comment thread lib/ds/arrayutils.flow Outdated
a[i % m][i / m]
);
j = ref 0;
i = ref for(0, \k -> (k < m) && (^j >= length(a[k])), \k -> k + 1);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

j=0 always

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, fixed.

Comment thread lib/ds/arrayutils.flow
j = ref 0;
i = ref for(0, \k -> (k < m) && (^j >= length(a[k])), \k -> k + 1);
generate(0, len, \__ -> {
x = a[^i][^j];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unsafe retrieval of element by index

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here retrieval is safe. It may be proved.

Comment thread lib/ds/arrayutils.flow
i = ref for(0, \k -> (k < m) && (^j >= length(a[k])), \k -> k + 1);
generate(0, len, \__ -> {
x = a[^i][^j];
i := for(^i + 1, \k -> (k < m) && (^j >= length(a[k])), \k -> k + 1);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for is not a functional style. please, don't use for

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for function itself is completely functional (see its definition). What is not "functional" here is usage of references. I use references to get efficiency and clear small implementation of a function.

@dmitry-vlasov
Copy link
Copy Markdown
Contributor Author

how many times are these functions used? (splitModulo and concatAModulo).
if no one uses them (1-2 times), then they should not be in the library at all. Why they are needed and what they do is also unclear.

I used these functions. What do these functions - I already explained to you thoroughfully. The concise explanation is given in comments. The general character of these functions mean that their place in the general library.

@shkel
Copy link
Copy Markdown
Contributor

shkel commented Apr 27, 2023

I used these functions.

used or use ? I suggest removing these functions

@dmitry-vlasov
Copy link
Copy Markdown
Contributor Author

used or use ? I suggest removing these functions

I cite your message: "люди ее используют так, как описано в комментарии. я не вижу проблемы чтобы убрать креш и соединить массивы. (People use it as it is described in a comment. I don't see a problem in fixing a crash and joining arrays)".
So you say yourself that someone uses it, why do yo suggest to remove these functions? You asked to make theses functions total - I fulfilled your request, so what's the problem now?

@shkel
Copy link
Copy Markdown
Contributor

shkel commented Apr 27, 2023

used or use ? I suggest removing these functions

I cite your message: "люди ее используют так, как описано в комментарии. я не вижу проблемы чтобы убрать креш и соединить массивы. (People use it as it is described in a comment. I don't see a problem in fixing a crash and joining arrays)". So you say yourself that someone uses it, why do yo suggest to remove these functions? You asked to make theses functions total - I fulfilled your request, so what's the problem now?

i do NOT use it. i found 2 uses of concatAModulo , and 0 of splitModulo

@dmitry-vlasov
Copy link
Copy Markdown
Contributor Author

used or use ? I suggest removing these functions

I cite your message: "люди ее используют так, как описано в комментарии. я не вижу проблемы чтобы убрать креш и соединить массивы. (People use it as it is described in a comment. I don't see a problem in fixing a crash and joining arrays)". So you say yourself that someone uses it, why do yo suggest to remove these functions? You asked to make theses functions total - I fulfilled your request, so what's the problem now?

i do NOT use it. i found 2 uses of concatAModulo , and 0 of splitModulo

  1. Why do you think that if you don't use it, nobody ever won't use it?
  2. Functions concatAModulo and splitModulo naturally come in pair since one is the reverse for the other.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants