示例#1
0
from oslash import put_line, get_line

main = put_line("What is your name?") | (lambda _:
    get_line() | (lambda name:
    put_line("What is your age?") | (lambda _:
    get_line() | (lambda age:
    put_line("Hello " + name + "!") | (lambda _:
    put_line("You are " + age + " years old"))))))

if __name__ == "__main__":
    main()
示例#2
0
from oslash import put_line, get_line

main = (put_line("What is your name?")
        | (lambda _: get_line()
           | (lambda name: put_line("What is your age?")
              | (lambda _: get_line()
                 | (lambda age: put_line("Hello " + name + "!")
                    |
                    (lambda _: put_line("You are " + age + " years old")))))))

if __name__ == "__main__":
    #print(main)
    main()
示例#3
0
文件: hello.py 项目: cbenz/OSlash
from oslash import put_line, get_line

main = put_line("What is your name?") | (lambda _:
        get_line() | (lambda name:
        put_line("What is your age?") | (lambda _:
        get_line() | (lambda age:
        put_line("Hello " + name + "!") | (lambda _:
        put_line("You are " + age + " years old"))))))

if __name__ == "__main__":
    main()
示例#4
0
文件: hello.py 项目: caiorss/OSlash
from oslash import put_line, get_line

main = put_line("What is your name?") >> (lambda _:
    get_line() >> (lambda name:
    put_line("What is your age?") >> (lambda _:
    get_line() >> (lambda age:
    put_line("Hello " + name + "!") >> (lambda _:
    put_line("You are " + age + " years old"))))))

if __name__ == "__main__":
    main()
示例#5
0
"""Hello example using do-notation."""
from oslash import put_line, get_line, do, let

main = do(put_line("What is your name?"), let(name=get_line()),
          put_line("What is your age?"), let(age=get_line()),
          lambda e: put_line("Hello " + e.name + "!"),
          lambda e: put_line("You are " + e.age + " years old"))

if __name__ == "__main__":
    #print(main)
    main()