On Sat, Aug 13, 2011 at 1:51 PM, Martin Baker <[email protected]> wrote: > On Saturday 13 Aug 2011 17:25:39 Ralf Hemmecke wrote: >> > Do you think first class types could be defined as in this article: >> > http://en.wikipedia.org/wiki/First-class_object >> >> Yes.
In the FriCAS library (i.e. in SPAD), types are static (constant): they are only created by the compiler, never at run-time, but types are still "first class" in the sense that they can otherwise be treated as values, assigned to variables (of the correct type) and passed as parameters to, and returned by functions. It is not entirely clear to me what is meant by "has intrinsic identity (independent of any given name)" in the above Wikipedia article. In FriCAS values have no intrinsic type. Nothing in the encoding of a value indicates it's type. That is why "pretend" is possible and indeed necessary in some specific instances to duck the static type restrictions. Only containers, i.e. constants and variables have types. >> >> > So perhaps, in Axiom/FiCAS terms: >> > >> > A first class *type* would be a *category* that could be generated, >> > stored, passed around and extended at run-time. >> > Categories cannot be generated or extended at run-time but they can be stored and "passed around". >> > A first class *object* would be a *domain* that could be generated, >> > stored, passed around, extended and constructed at run-time. >> Similarly domains cannot be generated or extended at run-time. > ... > As far as I can see the word 'object' represents a perfectly valid > mathematical concept, for example in category theory. > ... In the above Wikipedia article the word "object" is treated as a synonym for "value". I don't see any direct connection to category theory here. > >> > It seems to me that, for a CAS that can do discrete mathematics at the >> > highest levels of abstraction this would be needed. That is we need to >> > define structures, that can define further structures, that can define >> > further structures... >> >> Sorry, but I don't agree. You can do quite a lot with functions that >> return function that (in turn) return functions. >> >> Do you have a concrete use case where you would need recompilation? > It is certainly possible to define recursive data structures (types) in FriCAS and as Ralf pointed out functions are also first class objects. Perhaps I do not understand what you mean by "structures that can define further structures". > I am still trying to understand the maths here, from what I've > gathered so far the Yonada lemma allows some sort of shift between > objects and arrows? In which case we could always get round the > problem by lifting up to higher order functions. > I don't understand Yonada as a shift between objects and arrows. Also I do not see how this might connect to the discussion of types as first class objects. > However, when everything is lifted up to higher and higher order > functions I find the code very hard to follow, also the package that > works with higher order functions (Currying and stuff like that) seems > to have lots of warnings about buggy code. > Can you give some examples of such buggy code? > If we were going to take this to its extreme I guess we would end up > with pure functional code which has its own problems? > I do not see how functional programming relates to the discussion of types. In what sense can higher-order functions help to us to do "discrete mathematics at the highest levels of abstraction"? I am not so sure what you mean by "discrete mathematics" in this context. I do know some situations in which higher-order functions arise naturally when trying to implement concepts from category theory such as limits (product and co-product). > I think to make things manageable there is a need for some sort of > encapsulation to make code manageable. Again, I'm not talking about > OOP here, just the sort of encapsulation that SPAD domains provide. > That makes sense to me. Regards, Bill Page. -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/fricas-devel?hl=en.
