> How does this compare to the cost of testing case "failed" in the old
> Union(R,"failed") representation?

I did a crude benchmark on failed?, 200 loops over a vector with
10^6 elements of failed():

1. Union(NNI, "failed") 0.40s
2. Maybe NNI, 0.38s
3. "generic" Maybe NNI, can't be inlined, 1.24s

The problem with "generic" Maybe is that it can't be inlined.


About your changes to 'recip', a few comments:

1. There should be a function for 'not retractable?'

2. In xpoly.spad;

recip(p) ==
- p = 0 => "failed"
- p.first.k > 1$E => "failed"
- (u := recip(p.first.c)) case "failed" => "failed"
- (u::R)::%
+ p = 0 => failed
+ p.first.k > 1$E => failed
+ u := recip(p.first.c)
+ not retractable? u => failed
+ coerce(retract(u)::%)

There are 2 diferent coerce in the last line, I'd consider
  wrap(unwrap(u)::%)  more clear.

3. Again, my reasoning is that, when you see 'retract/coerce',
you don't know which type your are retract/coerce from/to,
you have to look up the context to know. With wrap/unwrap,
you are sure that you are dealing with Maybe.

Also, I have rebased my oldk1332/maybe branch a little.

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to