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()
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()
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()
"""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()