User loginNavigation |
The Problem with "dup" and "swap" in Stack-Based LanguagesOperations like "dup" and "swap" in stack-based languages are special in that they return multiple results (unlike most other languages which simulate multiple results by returning tuples). I find expressing the concept in a type system challenging (if anyone else has done it successfully I would definitely like to hear about it). One of the core problems is that the type of a function like eval, which is supposed to execute any function: eval : (a (a -> b) -> b) This makes a lot of sense when a function only has one argument and one result. I can reduce every function to an equivalent one having one argument: (a b -> c) = (a -> b -> c) But I do not know how to reduce a function to having one result. This leads to specific problems with certain terms, which I go into more depth on my blog ( http://cdiggins.com/2006/12/09/type-ambiguity-in-cat-and-the-importance-of-formalization/ ). The only solution I can think of is to creat another eval functions which returns two results: eval2 : (a (a -> b c) -> b c) Any thoughts? By cdiggins at 2006-12-10 21:50 | LtU Forum | previous forum topic | next forum topic | other blogs | 15432 reads
|
Browse archivesActive forum topics
|
Recent comments
5 hours 55 min ago
5 hours 58 min ago
4 days 19 hours ago
1 week 1 day ago
1 week 1 day ago
1 week 3 days ago
1 week 3 days ago
1 week 3 days ago
1 week 5 days ago
1 week 5 days ago