{"action":"created","issue":{"url":"https://api.github.com/repos/gkz/LiveScript/issues/875","repository_url":"https://api.github.com/repos/gkz/LiveScript","labels_url":"https://api.github.com/repos/gkz/LiveScript/issues/875/labels{/name}","comments_url":"https://api.github.com/repos/gkz/LiveScript/issues/875/comments","events_url":"https://api.github.com/repos/gkz/LiveScript/issues/875/events","html_url":"https://github.com/gkz/LiveScript/issues/875","id":146453737,"number":875,"title":"Is there a clean way to write async code in sequental form?","user":{"login":"ceremcem","id":6639874,"avatar_url":"https://avatars.githubusercontent.com/u/6639874?v=3","gravatar_id":"","url":"https://api.github.com/users/ceremcem","html_url":"https://github.com/ceremcem","followers_url":"https://api.github.com/users/ceremcem/followers","following_url":"https://api.github.com/users/ceremcem/following{/other_user}","gists_url":"https://api.github.com/users/ceremcem/gists{/gist_id}","starred_url":"https://api.github.com/users/ceremcem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ceremcem/subscriptions","organizations_url":"https://api.github.com/users/ceremcem/orgs","repos_url":"https://api.github.com/users/ceremcem/repos","events_url":"https://api.github.com/users/ceremcem/events{/privacy}","received_events_url":"https://api.github.com/users/ceremcem/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-04-06T22:32:44Z","updated_at":"2016-04-06T23:15:37Z","closed_at":null,"body":"Hi, \r\n\r\nI want to translate a code from Python to Livescript where callback hell comes into play. The most clean way I could find to implement following code: \r\n\r\n```\r\ndo_something()\r\nwhile True:\r\n    x = do_something_else()\r\n    if x == 0: \r\n        break\r\n    sleep(0.1)   # wait 100ms \r\ndo_another_thing()\r\n```\r\n\r\nis the following: \r\n\r\n```\r\nsleep = (delay, func) -> set-timeout func, delay\r\n\r\ndo-something!\r\na = -> \r\n    x = do_something_else!\r\n    if x != 0\r\n        <- sleep 100ms\r\n        a!\r\n    else \r\n        do_another_thing!\r\na!\r\n````\r\n\r\nIs there any way to write this code in a more readable form?\r\n\r\n## Edit\r\nNote: We don't have `Promise` option. "},"comment":{"url":"https://api.github.com/repos/gkz/LiveScript/issues/comments/206615882","html_url":"https://github.com/gkz/LiveScript/issues/875#issuecomment-206615882","issue_url":"https://api.github.com/repos/gkz/LiveScript/issues/875","id":206615882,"user":{"login":"naturalethic","id":1254,"avatar_url":"https://avatars.githubusercontent.com/u/1254?v=3","gravatar_id":"","url":"https://api.github.com/users/naturalethic","html_url":"https://github.com/naturalethic","followers_url":"https://api.github.com/users/naturalethic/followers","following_url":"https://api.github.com/users/naturalethic/following{/other_user}","gists_url":"https://api.github.com/users/naturalethic/gists{/gist_id}","starred_url":"https://api.github.com/users/naturalethic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/naturalethic/subscriptions","organizations_url":"https://api.github.com/users/naturalethic/orgs","repos_url":"https://api.github.com/users/naturalethic/repos","events_url":"https://api.github.com/users/naturalethic/events{/privacy}","received_events_url":"https://api.github.com/users/naturalethic/received_events","type":"User","site_admin":false},"created_at":"2016-04-06T23:15:37Z","updated_at":"2016-04-06T23:15:37Z","body":"Oh hah!  Yes I forgot to kick it off."}}