New Show Hacker News story: Show HN: Pith language. JavaScript with a little bit of Python syntax

Show HN: Pith language. JavaScript with a little bit of Python syntax
2 by gabrielsroka | 1 comments on Hacker News.
I've been writing a lot of JavaScript and Python lately. I like Python's syntax, so I created a language called Pith that's JS with some Python-like syntax (but without trailing colons). It's not a full compiler. It really just does search-and-replace, but I find it fun and useful in spite of some sharp edges. I use it on my smartphone to write and run short programs. Here's an example using the HN API: max = 6 ids = await getApi('topstories') for id in ids.slice(0, max) getItem(id) async def getItem(id) const d = document.createElement('div') results.appendChild(d) d.style = 'padding-bottom: 1em;' i = await getApi('item/' + id) ? i.title, '|', i.score u = '//news.ycombinator.com/item?id=' d.innerHTML = i.title.link(u + id) async def getApi(path) u = '//hacker-news.firebaseio.com/v0/' return getJson(u + path + '.json')

Comments

Popular posts from this blog

New Show Hacker News story: Show HN: Natural language Twitter search using Codex

Internet Download Manager Universal Crack is Here ! [IDM 6.25 Build 10 UPDATED]

New Show Hacker News story: Show HN: Movis – A Video Editing Library in Python