IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS // BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE.įirst we need to parse the expression, using the grammar givenīelow. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. Copyright 2019 by Robert Kovacsics // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation // files (the "Software"), to deal in the Software without // restriction, including without limitation the rights to use, copy, // modify, merge, publish, distribute, sublicense, and/or sell copies // of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. Let _loop_ (fn loop => fn n => if (eq0 n) To completion isn't as useful as just iterating a couple of steps, Will end up evaluating (pred 2) and (pred (pred 2)) rather than Chosing the non-strict strategyĪlways reduces to beta-normal form, but you might want to eagerlyĮvaluate the predecessor function when you see it, otherwise you Here you have to be careful about the order of the evaluation, Let pred2 (fn n f x => n (fn g h => h (g f)) (fn u => x) (fn u => u)) Let pred (fn n => snd (n (fn p => pair (succ (fst p)) (fst p)) (pair 0 0)))Īnd here is a faster predecessor, try it out to see how it works: Let add (fn n m => fn f x => n f (m f x)) Re-computation of the parse tables which is laborious, and it is notĪ high priority problem, as Poly/ML and GHC have the same parsing Yet, as it would require a change to the grammar, and hence a The point of -reduction is that it axiomatizes provable equality in the extensional -calculus.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |