As a follow-up, anonymous recursive functions in Axiom are described at:

https://rosettacode.org/wiki/Anonymous_recursion#Axiom

For the example:

        lab1method2(x: D, a: D, n: N): Float ==
            zero? n => a.1
            n = 1   => a.2
            n = 2   => a.3
            c := vector([x.1+x.2+x.3, -(x.1*x.2+x.2*x.3+x.3*x.1),
x.1*x.2*x.3])$V
            f : Reference((D, N) -> D) := ref((d, n) +-> d) -- dummy
definition required
            f() := (v,i) +-> if i=n+1 then v else _
                f()(directProduct(vector([v.2, v.3, c.1*v.3 + c.2*v.2 +
c.3*v.1])$V)$D,i+1)
            (f()(a,3)).3

Kindly, Mark.

On 31/10/20 4:32 pm, Neven Sajko wrote:
Yes, indeed, in the end I converted the DirectProduct to Vector (with
an extra variable) before entering the loop. The code is here:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnsajko%2Fdiscrete-math-lab1&data=04%7C01%7Cmark.clements%40ki.se%7Cbc6633bf80bf427e2dca08d87db23d2f%7Cbff7eef1cf4b4f32be3da1dda043c05d%7C0%7C0%7C637397552701816541%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=3TxfzvnLetINBcrAvKOgTpqTzEP3KNmniXeNhVgtYGg%3D&reserved=0

Thanks, everyone.

Neven




När du skickar e-post till Karolinska Institutet (KI) innebär detta att KI kommer att 
behandla dina personuppgifter. Här finns information om hur KI behandlar 
personuppgifter<https://ki.se/medarbetare/integritetsskyddspolicy>.


Sending email to Karolinska Institutet (KI) will result in KI processing your 
personal data. You can read more about KI’s processing of personal data 
here<https://ki.se/en/staff/data-protection-policy>.

--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/8140fc9d-0e74-8655-d79c-abe5449d7cbc%40ki.se.

Reply via email to