@mousetail is that soup.select("text")? That gives me a huge number of lines like <text depth="4.776" halign="center" height="14.352" matrix="1 0 0 1.25 292 -103" pos="320 224" size="small" stroke="Sblack" style="math" transformations="translations" type="label" valign="center" width="44.124">\cb O(n)</text>]
All is in the title. I wonder to know the difference between the two expressions \cB. and \CB\{
in regular expression (regex).
In the example below, it seems that both give the same result. Furthermore, one can mix them
i.e. one can use \cB\{ ... \cE.
\documentclass{article}
\ExplSyntaxOn
\tl_new...
def element(symbol: str, arity: int):
"""
Decorator to make elements
"""
def decorator(impl):
if symbol in elements:
raise Exception(f"Element {symbol} already in elements dict")
else:
elements[symbol] = process_element(impl, arity)
return impl
return decorator
Lost is a 2-D programming language where the start position and direction of the ip are entirely random.
Today we will be writing a Lost program which uses this randomness to simulate a coin flip.
A coin flip can have 3 outcomes:
It lands on "heads"
It lands on "tails"
It lands perfectly balance...
CMQ I have a sorted array of floating point numbers. I want to partition them into numbers less than x and numbers that are at least x for some x which I will choose . My goal is to minimise the variance of the two halves of the partition. Is there a clever way to choose x to do this?
@DLosc, I'm exploring concise methods to detect if the accumulator is negative in *Acc!!*. I've considered two approaches so far: 1. `(_^2)^2^-1-_` - this returns a float, which is inconvenient. 2. `1/_` - this fails when the accumulator is 0. Do you have any suggestions?
@Mukundan314 I'd say modify approach 2 to make sure the inverted quantity isn't 0. As long as it's an integer, you can do 1/(2*_+1), which has the added bonus (?) of giving a different value for positive (0), negative (-1), and zero (1).
If you just want a two-way distinction, you can do 1/(3*_+2) (negative = -1, nonnegative = 0) or 1/(3*_-1) (positive = 0, nonpositive = -1) or 1/(1-3*_) (positive = -1, nonpositive = 0).
@Ginger Kotlin seems fun, at least with the keywords youβre using in your code.
bananaβ‘ββββͺβ‘βͺβ βͺβ‘βͺββ ββͺβ‘βͺβ βͺβ’βͺββββ‘β β‘ββ’ββββͺβ‘βͺβ βͺβ£βͺββ ββͺβ‘βͺβ βͺβ€βͺββββ‘β β‘ββ£ββββͺβ‘βͺβ βͺβ’β‘βͺββ ββͺβ‘βͺβ βͺβ’β’βͺββββ‘β β‘β ba # ββ‘The first syllable: buh na # ββ’The second syllable: nah na # ββ£The third syllable: nuh 💎 Created with the help of [Luminespire](https://vyxal.github.io/Luminespire).
@Simd Since variance = mean of squares - square of mean, you can precalculate the prefix sums, suffix sums, and the same for the squares (which can be done in O(n)), and then calculate all variances again in O(n), and pick the best one.