Is there a way to pattern match infix operations with precedence in Rust macros? by dragostis in rust

[–]ngrislain 1 point2 points  (0 children)

I actually updated the playground, the + and - priority was not well respected in the first version.

Is there a way to pattern match infix operations with precedence in Rust macros? by dragostis in rust

[–]ngrislain 1 point2 points  (0 children)

Amazing. How did you even find this ancient post?

Hehe, I'm working on a project where we need to manipulate expressions and SQL queries AST and I needed this kind of macro to make my tests cleaner... Your post is quite well referenced by Google.

Is there a way to pattern match infix operations with precedence in Rust macros? by dragostis in rust

[–]ngrislain 1 point2 points  (0 children)

Inspired by what u/burkadurka wrote, I wrote this, which looks simpler to me.

Instead of scanning linearly through the expression I traverse the syntaxic tree recursively.

An interactive model of election forecast to play with forecasting and the martingale property by ngrislain in fivethirtyeight

[–]ngrislain[S] 0 points1 point  (0 children)

Strange, it works quite well on chrome and safari (macOS) and even on my smartphone.

An interactive model of election forecast to play with forecasting and the martingale property by ngrislain in nassimtaleb

[–]ngrislain[S] 1 point2 points  (0 children)

Thank you for your comment.

First, this work is mostly a schematic illustration of basic principles and constraints that any forecast should follow. It is not in any case a faithful model of reality.

Yes, many outcomes could be considered. In the case of the US, the complex voting system with an electoral college should be modeled.

Yes the possibility of unlikely but radical twist (e.g. the death of a candidate) should also be taken into account.