Skip to content
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

Manage the multiplication (and division) between two value wrapped in the same metric-system #6

Open
xvw opened this issue Oct 17, 2017 · 0 comments

Comments

@xvw
Copy link
Owner

xvw commented Oct 17, 2017

Actually, Mizur could not proceed "non-linear" operation, ie: 1cm * 2cm.

     @doc """
      Multiplies a `typed_value` by a `number`. The subtype of the return value 
      will be the subtype of the left `typed_value`.
      """
      @spec times(t, number) :: t 
      def times(a, b) when is_number(b) do 
        x = unwrap(a)
        %{ a | value: (x * b)}
end

Actually, you can do 1cm * x and not 1cm * 2cm (because x.cm * y.cm should equals x*y cm2.
The goal of this issue is to manage a "base notion" and preserve the coercion function.

Good Luck

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

No branches or pull requests

1 participant