by gilch1 min read26th Aug 201922 comments
New Comment
22 comments, sorted by Click to highlight new comments since: Today at 9:30 AM

Hissp: It's Python with a Lissp.

(Linkpost for the Hissp tutorial. $ pip install hissp and follow along.)

Hissp is a programming project I've been working on recently. It's a modular Lisp implementation that compiles to a functional subset of Python--Syntactic macro metaprogramming with full access to the Python ecosystem.

  • GitHub repo
  • Hebigo: an experimental indentation-based skin for Hissp.
  • drython: An earlier experiment of mine that built much of the conceptual foundation for Hissp. Its readme has an introduction to metaprogramming concepts in Python.

What are the notable differences between Hissp and Hy? (Hyperlink to "Hy" in previous sentence is just for convenience and the benefit of readers; as you know, we're both former contributors.)

They're both Lisps that can import Python, but Hissp has a very different approach and philosophy.

I'm not sure how closely you've been following Hy after you left the project, but for the benefit of other readers, I'll go into a little more detail. As you say, I was also a major contributor to the open-source Hy project, and am still part of the core development team. For a time I was one of the more active members, but my activity has since diminished. I realized that correcting some of Hy's deeper flaws might require a pretty deep rewrite, but building consensus with the few remaining active members of Hy's team proved too difficult. Hy is obviously a much older project than Hissp with more contributors and more time to develop. While my experience with Hy informs my design of Hissp, Hissp is not a fork of Hy's source code, but a completely new project with a fundamentally different architecture.

The biggest difference is that Hy compiles to Python abstract syntax trees (or "AST", an intermediate stage in the compilation of Python code to Python bytecode). In contrast, the Lissp language uses Hissp as its AST stage instead, and compiles that to Python code, which Python then compiles normally. Hy compiles to a moving target—Python's AST API is not stable. This helps to make Hissp's compiler simpler than Hy's.

Hissp code is made of ordinary Python tuples that serve the same role as linked lists in other Lisps, or Hy's model objects. Using these directly in Python ("readerless mode") is much more natural than writing code using Hy's model objects, although using the Lissp (or Hebigo) language reader makes writing these tuples even easier than doing it directly in Python.

Hissp is designed to be more modular than Hy. It supports two different readers (Lissp and Hebigo) with the potential for more. These compile different languages that represent the same underlying Hissp-tuple AST. The separate Hebigo language is indentation based, while the included Lissp reader uses the traditional s-expressions.

Hy code requires the hy package as a dependency. You need Hy's import hooks just to load Hy code. But Hissp only requires hissp to compile the code. Once that's done, the output has no dependencies other than Python itself. (Unless you import some other package, of course.) This may make Hissp more suitable for integration into other projects where Hy would not be a good fit due to its overhead. Hissp has already attracted some interest from the symbolic-pymc project for this reason.

Hy's compiler has a special form for every Python statement and operator and has to do a lot of work to create the illusion that its statement special forms behave like expressions. This complicates the compiler a great deal, and doesn't even work right in some cases, but allows Hy to retain a very Python-like feel. The decompiled AST also looks like pretty readable Python. Not quite what a human would write, but a good starting point if you wanted to translate a Hy project back to Python.

But after writing Drython, I realized that the expression subset of Python is sufficient for a compilation target. There is no need to do the extra work to make statements act like expressions if you only compile to expressions to begin with. It turns out that Hissp only required two special forms: quote and lambda. This makes Hissp's compiler much simpler than Hy's. But the lack of statements makes it feel a bit more like Scheme and a bit less like Python. And, of course, the expression-only output is completely unpythonic.

Another major difference is Hissp's qualified symbols. This allows macros to easily import their requirements from other modules. Macro dependencies are much harder to work with in Hy. I suggested a similar solution, but it has not been implemented in Hy so far.

I haven't covered every feature of Hissp, so there are more differences. See the tutorial and FAQ for a bit more thorough overview.

I currently have a small percentage of my portfolio in Ethereum. I'm considering making it a large percentage, maybe 20%, due to the Squish Chaos report. It was mentioned here on LW earlier, but didn't generate much discussion. Squish claims to be about 90% in Ether. The case seems compelling: Ether price could easily go up 7x on fundamentals and maybe 50x in the short term, probably within a year, at least according to the report. If true, this is an amazing opportunity, similar to being a Bitcoin early adopter, but the case seems too one-sided. I'm detecting a whiff of greed and groupthink from some other traders I've been discussing this with.

He who knows only his own side of the case, knows little of that. His reasons may be good, and no one may have been able to refute them. But if he is equally unable to refute the reasons on the opposite side; if he does not so much as know what they are, he has no ground for preferring either opinion. —J.S. Mill

So can someone please talk me out of it?

My best counter-case so far: Ether is extremely volatile and has dropped 90% before. (But eventually recovered.) Crypto is very over-hyped generally. (But this report seems unusually well-researched.) If I took every crypto bet that seemed good, I'd quickly lose my shirt. (But I rarely make bets this size. Even if I'm wrong, I'd probably recover from an ~18% loss within a year from my other investments.) By the EMH, if the future price is known, it should cost that much already, sans the risk-free rate and premium for risk. (But crypto markets are clearly not efficient yet, Squish makes a case why this can't be priced in yet.) Any time there's an Ethereum software update, we risk a hack. (The risk is still worth it, and another update could reverse losses, cf Ethereum Classic origin.) Ethereum is a bubble/ponzi scheme that could collapse at any moment. (Ethereum might have a better case on fundamentals that Bitcoin. Since Bretton Woods, fiat is also ponzi-like, yet stable enough due to policy. Squish suggests that Ether should be worth 7x current value on fundamentals alone.) The fundamental valuation is circular: smart contracts are only useful for making more kinds of tokens. (Even assuming 0 fundamental value, current prices are much higher than 0 now. Canada already has an ETF for Ether, the US will probably follow suit.)

Announcing the release of Hissp 0.2.0, my Lisp to Python transpiler, now available on PyPI.

I've overhauled the documentation with a new quick start in the style of Learn X in Y minutes, and a new macro tutorial, among other things.

New features include raw strings, module literals, unqualified reader macros, escape sequences in symbols and improvements to the basic macros.

I suggest putting those links inside those links. For example, on the github page, changing:

Also available on PyPI.

to

Also available on PyPI.

Added that PyPI link to the release page. Although it was referring to the pip install command below that.

As always, not investment advice. There are signs that a volatility spike is imminent, which often coincides with a market drop. I have reversed my usual short vol position and bought tail insurance (e.g. OTM puts). Remember vol can fall just as quickly. How long a spike lasts depends on how high it goes.

Hissp 0.3.0 is up. Check it out.

pip install -U hissp==0.3.0

Hey, the example uses Hypothesis 😁 Always nice to see it in the wild.

Hypothesis was invaluable for getting the Unicode munging working properly. So many edge cases.

Oh yeah. My personal favourite is the NFKD-normalization of identifiers, though I haven't built that into hypothesmith yet.

I'm seeing some serious stock market instability starting near the end of the trading day today. The volatility curves are making me nervous. Sometimes it passes without much happening, but I think there's an elevated risk of a market crash in the next day or three. I can't say how hard. If this instability persists tomorrow morning, I'll be taking some precautions, probably going long volatility. If I had been paying more attention, I might have done this at the end of the trading day today. [As always, I am not your financial advisor, and without knowing your financial situation this cannot be financial advice. Please don't bet the farm. You are responsible for your own money.]

Charting is mostly superstition. This isn't based a gut feel, but on some statistical analysis of past market behavior that has been reliable enough in the past for me to take seriously. I'll try to remember to update this thread in the morning.

At market open, the instability I was seeing appears to have passed. That did not last long. I'll keep checking it.

It's a day later, and I'm seeing it again, but barely. I want to see if it persists a while before acting so I don't get whipsawed.

The instability appears to have passed. I didn't go long vol, although I had rebalanced early to reduce some dangerous exposure and reduced my usual small short vol position. I've now restored my usual short vol position. It could be months before we see a blip like this again.

I bought VIX a while ago when it was at 22 expecting this and while it took longer to go up than I expected but it is now rising and at >30 (peak during early Covid was > 60).

I have the same concern. I've been worried about a bubble for a while given all the extra money in stocks pushing up prices well past fundamentals. I expect a correction, but it's hard to know when the market will coordinate to do it because of lack of other places to put stuff. Today felt nuts in a way I expect a reaction. Consequently, I've put my money where my mouth is and rebalanced my portfolio to be more conservative for a while.

Reminder that "The Merge" for Ethereum is coming up soon. There are bullish signs, like call-to-put ratios. Totally not advice, and please Don't bet the farm; crypto has high volatility.

I'm seeing some serious stock market instability this morning. I'm calling it. Market is crashing. I can't say how hard or for how long. The reasons should be obvious, but I'll say it: the present war in Ukraine.

I'll be taking some precautions, including going long volatility, and buying some index puts. I am not your financial advisor, but seriously, take a look at your portfolio RIGHT NOW!

These are short-term plays. Theoretically, puts will rapidly deflate in value once the market bottoms, so if one were to buy some defensively (or aggressively), one should be prepared to sell them quickly after volatility peaks.

Charting is mostly superstition. This isn't based a gut feel, but on some statistical analysis of past market behavior that has been reliable enough in the past for me to take seriously. I'll try to remember to update this thread when I sell off my puts.

ETA: For those who can't trade options, there are inverse index ETFs, which are also short-term plays. These may not be available to everyone. It may also be prudent to scale back any broad market exposure (i.e. anything correlated with the S&P 500) in proportion to current volatility, until the current volatility spike passes. This follows from Kelly. Whatever you do, don't jump off at the bottom. This too shall pass.

Risk is still elevated, and surprises are possible, but insurance is no longer worth the cost to me. The market has regained its footing. I've removed my precautions, as of today.

Market appears to have bounced as of this morning. Indicators of instability persist, however, they do lag a bit. In my estimation, risk level is still high, so my precautions remain.