-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problems with Generic Reduce example #22
Comments
To be clear. That and the other examples that are currently in the repository are largely a capture of a prototyping discussion at the Tokyo meeting. (I'm not even sure at the moment which work I did on this particular example - I think I just varied some things to ask "what if" questions.) The more full-fledged example is the block-matrix where I took it away as a homework exercise and iterated a couple of times with Magne. In any event to be fully intelligible (aside from the fact that they don't even compile as written), there needs to be some writeup of the approach that Magne was having us follow. With insight one might be able to glean the method to his madness, but it probably would be much better with a nice exposition. I do believe there were variants of this particular example that I or Damian did get to compile. The C preprocessor was used to enable some of the pseudo syntax. But again, we were rapidly doing different variations and it is not suprising that some things were lost by the time anything was captured in a repository. I am a bit surprised that the Cheers |
PS - I encourage you to provide your improvements above as a PR. |
I have greatly modified my improvements, put each alternative in a separate file, added markdown documentation in the document reduce.md, and submitted a PR. |
In the scenarios directory @tclune has attempted to provide use cases and examples of how generics might work in Fortran. I have only examined in detail his Generic Reduce example. His reduce.F90 code has a number problems as an example:
sum
andproduct
as if they were the function result in the same function.Below are four examples that attempt to fix the most obvious problems, though they may have problems of their own. In addition to fixing the above problems, they differ from @tclune's examples in that they: first, only define one reduction procedure while he attempts to define several; and second, use a function and not an operator as the operation to be reduced. The three examples differ in how the function is associated with the reduction procedure: the first makes it an explicit argument to the reduction procedure; the second makes it a type bound procedure; the third makes it an explicit parameter to the generic module; and the fourth implicitly imports the function from the scope of the instantiation.
or
or
or
The text was updated successfully, but these errors were encountered: