added gracefull shutdown
[mTask.git] / Tasks / Examples.icl
index 78b0d67..2e2a973 100644 (file)
@@ -6,12 +6,21 @@ import mTask
 import Devices.mTaskDevice
 import iTasks._Framework.Serialization
 
+faculty :: Int -> Main (ByteCode () Stmt)
+faculty i = sds \y=i In sds \x=1 In {main =
+       IF (y <=. lit 1) (
+               pub x :. retrn
+       ) (
+               x =. x *. y :.
+               y =. y -. lit 1
+       )}
+
 countTo5 :: Main (ByteCode () Stmt)
 countTo5 = sds \x=0 In {main =
        x =. x +. lit 1 :.
        pub x :.
        IF ( x >. lit 5) (
-               retrn x
+               retrn
        ) (
                noOp
        )}
@@ -78,4 +87,5 @@ allmTasks = 'DM'.fromList
        ,("blinkShare", treturn blinkShare)
        ,("count", treturn count)
        ,("countTo5", treturn countTo5)
+       ,("faculty", enterInformation "Faculty" [] @ faculty)
        ]