That makes perfect sense, thank you.
On Tuesday, February 6, 2018 at 12:43:07 AM UTC+1, Sam Tobin-Hochstadt
wrote:
> The problem is that the definition of `(Dual-Number N)` includes `N`,
> and therefore
>
> (Dual-Number (Dual-Number String)) might either be a (D (D "x" "y") (D
> "x" "y")) or
On Mon, Feb 5, 2018 at 6:36 PM, HiPhish wrote:
> Why would that be a problem? The caller has to provide a function for
> "adding"
> and "multiplying" an N, and as long as I define what it means to multiply
> and
> add strings it shouldn't matter that I'm using a dual number where both
> components
Why would that be a problem? The caller has to provide a function for
"adding"
and "multiplying" an N, and as long as I define what it means to multiply
and
add strings it shouldn't matter that I'm using a dual number where both
components are strings.
But I think this is a case of the rectangle
I'm not sure how the "If" got there.
But to say more, consider your function:
(: dual-* (∀ (N) (→ (Dual-Number N) (Dual-Number N) (→ N N N) (→ N N
N) (Dual-Number N
(define (dual-* d1 d2 * +)
(cond
[(D? d1)
(D
(D-real d1)
(D-dual d1))]
[else (D d1
Did your email get cut off?
On Monday, February 5, 2018 at 6:00:05 PM UTC+1, Sam Tobin-Hochstadt wrote:
>
> This is an unfortunately common pitfall -- if you instantiated N with
> something that includes a dual number, then the type error would be
> pointing to a real bug. If
>
> Sam
>
--
You
This is an unfortunately common pitfall -- if you instantiated N with
something that includes a dual number, then the type error would be
pointing to a real bug. If
Sam
On Feb 5, 2018 7:26 AM, "HiPhish" wrote:
> Thank you for your answer, Sam.
>
> 1) does not really capture it, and 2) is a proo
Thank you for your answer, Sam.
1) does not really capture it, and 2) is a proof of concept that hasn't been
updated in almost a year. But it did give me a good idea: use Typed Racket
and
have the type system work for me.
(struct (N) D ([real : N] [dual : N]))
(define-type (Dual-Number N) (U
A few answers:
1. Use struct subtyping to give a type that includes both kinds:
(struct dual ())
(struct quaternion dual (scalar vector))
(struct dual-quaternon dual (real dual))
2. Use a library that supports algebraic data types, such as
https://pkgs.racket-lang.org/package/datatype
Hell Racketeers,
I am trying to write an implementation of the mathematical concept of dual
quaternions in Racket. Dual quaternions are an algebraic type and there are
several equally valid way to look at them.
Let me give some background first. A dual number (a + bε) is similar to a
complex numb
9 matches
Mail list logo