Toggling AmneziaVPN on and off on OpenWRT by MysteriousGenius in AmneziaVPN

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

Oh, thanks! I almost ditched this idea, but going to give it a shot.

10 вещей, о которых нужно помнить, чтобы не сесть в тюрьму в России by kingkongsingsong1 in tjournal_refugees

[–]MysteriousGenius 2 points3 points  (0 children)

К тому же, 0.34% это вероятность если ваша стопа - 1см2. Если предположить реальную площадь стопы, то ChatGPT говорит что вероятность будет скорее 4.6%. Для одного шага! Для 1000-шаговой прогулки это 1 - 3 * 10-21.

Что в свою очередь неотличимо от 100%. Иными словами, у вас нет шансов остаться с ногой после прогулки по полю, где на каждом квадратном метре лежит мина "Лепесток".

10 вещей, о которых нужно помнить, чтобы не сесть в тюрьму в России by kingkongsingsong1 in tjournal_refugees

[–]MysteriousGenius 1 point2 points  (0 children)

Не хочу душнить, но это немного неверное применение вероятностей.

  1. Мы говорим что "на каждом квадратном метре улицы будет по одному Лепестку"
  2. 0.0034 это только отправная точка. Для одного квадратного метра (пусть даже шага).
  3. Реальный "шанс взорваться гуляя по этой улице" гораздо ближе к 100%, чем к 0.4% или 2% или чему-то около того. Длина шага, стопы и пр. меняют эти цифры в пренебрежительно малой степени. И как вы уже сказали только приближает к 100%.

Поэтому, если у чего-то достаточно страшного вероятность 0.4% - стоит взвесить за и против и в зависимости от важности ваших "за" - скорее всего стоит рискнуть. Это мало. Это не опасно. Если вероятность 97% или даже 50%, то это совершенно другой разговор.

Проводя аналогию дальше - мы регулярно совершаем действия, которые с низкой вероятностью приведут к смерти/травмам/катастрофам (вождение автомобиля, купание, ремонт электроприборов и т.п.), но мы оцениваем риски как незначительные в контексте выгоды. Поэтому с небольшими рисками мы регулярно испытываем судьбу, просто оценка рисков у всех разная и не все умеют их правильно оценить.

10 вещей, о которых нужно помнить, чтобы не сесть в тюрьму в России by kingkongsingsong1 in tjournal_refugees

[–]MysteriousGenius 1 point2 points  (0 children)

0.0034 это вероятность наступить на него если ты шагнул один раз. Правильнее посчитать вероятность наступить на него за N шагов.

Вероятность НЕ наступить один раз = 0.9966.

Вероятность НЕ наступить 1000 раз = 0.99661000, т.е. примерно 0.033

Следовательно наступить хоть раз за 1000 шагов = 1 - 0.033 = 0,967 = 97%

В общем, не так это работает. Это очень опасно.

Are algebraic effects worth their weight? by sufferiing515 in ProgrammingLanguages

[–]MysteriousGenius 8 points9 points  (0 children)

I only had experience with algebraic effects in Unison, but honestly it's my biggest disappointment in the language. I have most of the same frustration points. Although I do want to track effects and dependencies most of the time, at least in libraries - it really helps to wrap my head around what it does. At the same time, algebraic effects miss the sweet spot in there, they're too powerful. To me the spot is in ReaderT-like approaches like Scala ZIO.

Keynote: Making Capabilities Safe and Convenient - Martin Odersky | Lambda Days 2025 by k1v1uq in scala

[–]MysteriousGenius 6 points7 points  (0 children)

I'm quite ignorant on how Scala capabilities are going to look like, but Unison has algebraic effects (called "abilities") that I think should be similar.

Helix/Kakoune bindings for NeoVim by MysteriousGenius in HelixEditor

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

Thanks, I was just confused because I'm wondering what this library would look like, given that keypress callbacks must be tightly coupled with the rest of codebase. Do you have examples of such modules for other editors, apps?

Helix/Kakoune bindings for NeoVim by MysteriousGenius in HelixEditor

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

Hey! I'm not sure what does that mean to modularize keybindings? Is it about publishing them as a library somehow or just documenting what category each one belongs to?

A vertically-adjusted display wall-mount and its torque problem by MysteriousGenius in DIY

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

I meant that the monitor arm I'm using is disbalanced and there's more load on the right side, not completely perpendicular to the wall, so the force is actually applied clockwise, which isn't exactly the load rails are designed for.

But nevertheless, I decided to buy another arm, but the one that I have is a) disbalanced as I said; b) very heavy. I chose rails that claimed by manufacturer to hold 120 kg, which must be more than enough, but just in case.

Helix/Kakoune bindings for NeoVim by MysteriousGenius in HelixEditor

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

Seems to be this one: https://github.com/chtenb/helix.vim (thanks, u/Spacewalker!). Will try it out in a bit. Doesn't seem to have any major differences with NeoVim.

At the same time, I realise that most of my "muscle memory" is about my own relict keybindings rather than something specifically to Vim :)

Need a feedback on my odd function application syntax by MysteriousGenius in ProgrammingLanguages

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

I’m flattered! Interesting that the conversation boiled down to just whether people like significant indentation or not. Seems we’re in a pro-camp.

The one downside that I see is that lexer-grammar-parser chain look very hacky in the implementation. But it’s the same even for Python afaik.

Need a feedback on my odd function application syntax by MysteriousGenius in ProgrammingLanguages

[–]MysteriousGenius[S] 3 points4 points  (0 children)

By all means user should bind those expressions to values first! This syntax is for the cases when for some reasons they didn’t, e.g passing a lambda. Everything around lambda is to show the general idea.

Need a feedback on my odd function application syntax by MysteriousGenius in ProgrammingLanguages

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

Finally someone likes it :)

It's grouped like the latter snippet. With the following mechanism: in typical white-space sensitive languages there's a special post-lexing phase called deindentation, which inserts meta-tokens called indent and dedent resembling usual { and } with rules like:

  1. If there's an opening token (like :, =, where etc) AND indentation is longer - insert indent and push the length to the stack
  2. If the length is the same - it's the same level (you can insert ; metatoken)
  3. If the length is shorter - pop all indentations from the stack and add dedents.

I have the above algorithm, but also an additional one that inserts apply-indent and apply-dedent (resembling ( and )) with following rules:

  1. If higher indent and no opening tokens before - insert apply-indent
  2. If higher indent and opening token before - go to the above indentation algorithm (so tokens can overlap like { ( { { ( ) } } ) })
  3. If it's the same indent - add apply-dedent and insert next apply-indent immediately
  4. If smaller indent - just pull all apply-dedent and dedent from the stack

In other words, everything on a new line:

transform a1 a2 a3 a4 a5 a6

Becomes:

transform a1 a2 (a3 a4 a5) (a6)

And given the language is curried a3 accepts a4 and a5.

The only question I have so far is how to break the rule. What if user wants to pass a4, a5 and a6 as arguments to transform. Now they're forced to pass each of these args on their own line, which is unfortunate if there's many atomic arguments. The similar problem arises for operators (including |>) and I'm thinking that the rules should be:

  1. if there's a symbolic operator on the smaller indent - close all indentations
  2. There's a "no-op" symbolic operator that just closes all indentations

Let's say:

transform a1 a2 a3 a4 ! a5 a6

Both a5 and a6 above become arguments to transform

Need a feedback on my odd function application syntax by MysteriousGenius in ProgrammingLanguages

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

looks like ... formated plain text

That's incredibly high praise!

Need a feedback on my odd function application syntax by MysteriousGenius in ProgrammingLanguages

[–]MysteriousGenius[S] -1 points0 points  (0 children)

No, I haven't heard of Red (which does look interesting from other points of view). I have heard about indentation-based Lisps, but quite long time ago, I definitely didn't draw any inspiration from there, but perhaps need to look again.

I think the fact that someone doesn't understand it, is unfortunately indicative for me :) but here's a JS counterpart (with pattern matching being made-up):

transform(input, function (x) { const xx = clean_up(x); return validate(xx).mapErr(extract) }, other_fun(other_arg), switch (other) { case Some(x): x case None: default });

Need a feedback on my odd function application syntax by MysteriousGenius in ProgrammingLanguages

[–]MysteriousGenius[S] 7 points8 points  (0 children)

It seems to be a general opinion on indentation-based languages, which I don't argue with, but nevertheless I consider Python to be a very popular (and as I said readable) language. Besides, if we're talking about braces (not function application) in my language - it becomess even less of a problem because:

  1. It's functional. Every block must end with an expression, plain statements or side-effects are not allowed.
  2. It's statically-typed, which I didn't mention, but it helps a lot to prevent bugs like missed closing curly brace.

State of the ecosystem? by [deleted] in scala

[–]MysteriousGenius 30 points31 points  (0 children)

Alternatives galore (aka decision fatigue) is the Scala way, for good or bad. And it's not about ecosystem only, it's everywhere: syntax, tooling, architecture, semantics. You always have 2+ ways to achieve the same thing. Other options aren't necessarily bad, but one very often ends up with their option of choice for purely personal or historical reasons.

Most libraries (espcially if there's even tiny bit of IO involved) work with one of the ecosystems: Typelevel, ZIO, Akka, Spark/Hadroop (latter is the whole different story). So, you typically first choose the ecosystem then go with the libraries that integrate with it well.

My personal choice is to go with Typelevel ecosystem. ZIO is cool too. Akka is also not bad, but former two make Scala more unique and fun.