7parseNumber : String -> { [EXCEPTION String] } Eff Int
9 = if all (\x => isDigit x || x == '-') (unpack str)
11 else raise "Not a number"
13vadd : Vect n Int -> Vect n Int -> Vect n Int
15vadd (x :: xs) (y :: ys) = x + y :: vadd xs ys
17vadd_check : Vect n Int -> Vect m Int ->
18 { [EXCEPTION String] } Eff (Vect m Int)
19vadd_check {n} {m} xs ys with (decEq n m)
20 vadd_check {n} {m=n} xs ys | (Yes Refl) = pure (vadd xs ys)
21 vadd_check {n} {m} xs ys | (No _) = raise "Length mismatch"
23read_vec : { [STDIO] } Eff (p ** Vect p Int)
24read_vec = do putStr "Number (-1 when done): "
25 case run {m=Maybe} (parseNumber (trim !getStr)) of
26 Nothing => do putStrLn "Input error"
28 Just v => if (v /= -1)
29 then do (_ ** xs) <- read_vec
33do_vadd : { [STDIO, EXCEPTION String] } Eff ()
34do_vadd = do putStrLn "Vector 1"
38 putStrLn (show !(vadd_check xs ys))
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list