Closed boustrephon closed 7 years ago
This is a non-ideal interaction between the cell-by-cell basis of Jupyter Notebooks and F# needing a fixed type for your function as specified. We send each cell to the F# compiler as an individual unit so when you split addTuple6 to its own cell, it has to resolve the types, which by default with + is going to go with int.
A good solution for this is inline
https://docs.microsoft.com/en-us/dotnet/articles/fsharp/language-reference/functions/inline-functions which allows the compiler to generate specialised versions as need.
If you do that with addTuple6 you'll be able to split your code to multiple cells
let inline addTuple6 (a, b, c, d, e, f) (g, h, i, j, k, l) = (a+g,b+h,c+i,d+j,e+k,f+l)
Hope this is useful.
I'm going to close this issue as it is an interaction between F# type specialisation and Jupyter's cell-by-cell approach. If anyone has an alternative feel free to re-open. Hope inline
is useful.
Thanks... much appreciated.
Thanks. It worked. Much appreciated...
On 19 April 2017 at 22:53, Colin Gravill notifications@github.com wrote:
I'm going to close this issue as it is an interaction between F# type specialisation and Jupyter's cell-by-cell approach. If anyone has an alternative feel free to re-open. Hope inline is useful.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/fsprojects/IfSharp/issues/141#issuecomment-295297928, or mute the thread https://github.com/notifications/unsubscribe-auth/ANW8ng6kLaFDdpmskMA66xbyThJ9w7K-ks5rxh_rgaJpZM4Msq-G .
Description
I have defined three functions in two cells. In my original version I put the definition of
addTuple
in the first cell, andmu6
andfullSecProp2D
in the second. However, when I did so, I got a type error as below.Repro steps
If you copy my code into a notebook, you should get the same problem.
Expected behavior
I would expect this to simply compile and give no error.
Actual behavior
Line 14 corresponds to
| b::c -> addTuple6 (mu6 b c.Head) (recSecProp2D c)
Known workarounds
Related information