#🪅-progaming

1 messages · Page 78 of 1

valid jetty
#

one of the candidates answered a cyclic tree and referenced the travelling salesman problem so that was cool

#

one of them could not name a favourite data structure

#

i was like ok interesting so i started scrolling and looked at the scrollbar WHY IS IT SOOOO LONG

hoary sluice
#

but also multiple months of work

valid jetty
#

yeah i realized

hoary sluice
#

and a big mess of backwards compatibility

valid jetty
#

my favourite question was the data structure one lmfaoooo

#

it really brings out how much the teacher knows in a single question

hoary sluice
#

wtf does this mean

#

why is it not reformatted

valid jetty
#

i can imagine this one is for a very specific day in aoc and has neer been used since

hoary sluice
#

yop

#

most likely 2024 cause theres no comment

valid jetty
#

oooo i have an idea

hoary sluice
#

day 12 2024

#

the garden fencing one

valid jetty
#

should i make a builtin method on enums called entries such that ```rs
enum Foo {
A,
B,
C
};

fn Foo::entries() {
return [Foo::A, Foo::B, Foo::C];
}

hoary sluice
valid jetty
#

this would be done in the same place where the default formatter and the equals method is defined

hoary sluice
#

i think it detects how many cornerns the grid has cause its not actually a grid but a map of 2d point to T so it can be an arbitrary shape

#

well no shit isHowManyCorners detects amount of corners 🤯 but why is it not called getCornerCount or just val cornerCount get() =

#

val corners get() =

valid jetty
#

the shape corner count isHowManyCorners???

#

i have absolutely no fucking clue what my d12 code does anymore

#

like wtf is this

import sys

def sol(grid, part2):
    ds = [(0, 1), (0, -1), (1, 0), (-1, 0)]
    res = 0
    rs = {}
    v = set()

    def dfs(r, c, p):
        a = set()
        stack = [(r, c)]

        while stack:
            x, y = stack.pop()

            if (x, y) in v or x < 0 or x >= len(grid) or y < 0 or y >= len(grid[0]) or grid[x][y] != p:
                continue

            v.add((x, y))
            a.add((x, y))

            for nx, ny in [(x + 1, y), (x - 1, y), (x, y + 1), (x, y - 1)]:
                if (nx, ny) not in v:
                    stack.append((nx, ny))
        return a

    for r in range(len(grid)):
        for c in range(len(grid[0])):
            if (r, c) not in v:
                area = dfs(r, c, grid[r][c])
                if grid[r][c] not in rs:
                    rs[grid[r][c]] = []
                rs[grid[r][c]].append(area)

    for areas in rs.values():
        for area in areas:
            bc = 0
            sc = 0

            for p in area:
                for d in [(p[0] + dx, p[1] + dy) for dx, dy in ds]:
                    if d not in area: bc += 1

            for d in ds:
                s = set()
                for p in area:
                    x = p[0] + d[0], p[1] + d[1]
                    if x not in area: s.add(x)

                rs = set()
                for p in s:
                    x = p[0] + d[1], p[1] + d[0]
                    while x in s:
                        rs.add(x)
                        x = x[0] + d[1], x[1] + d[0]
                sc += len(s) - len(rs)

            res += len(area) * (sc if part2 else bc)
    return res

with open(sys.argv[1]) as f:
    contents = f.read()
    grid = [list(row) for row in contents.split('\n') if row.strip()]
    print(sol(grid, False))
    print(sol(grid, True))
hoary sluice
#
package solutions.y2024

import Solution
import utils.chargrid
import utils.grid.Grid
import utils.point.Point
import java.io.File

class Day12 : Solution(2024) {

    override fun solvePart1(input: File) = solve(input) { grid, cur, c -> cur.getCardinalNeighbors().filter { grid[it] != c }.size }

    override fun solvePart2(input: File) = solve(input) { grid, cur, _ -> grid.isHowManyCorners(cur) }

    private fun solve(input: File, getPerimeter: (Grid<Char>, Point, Char) -> Int): Int {
        val grid = input.chargrid()
        val seen = mutableSetOf<Point>()

        return grid.data.keys.sumOf { p ->
            val connected = HashSet<Point>()
            val c = grid[p]!!
            val q = ArrayDeque<Point>()
            q.add(p)
            var perimeter = 0
            while (q.isNotEmpty()) {
                val cur = q.removeFirst()
                if (!seen.add(cur)) continue
                connected.add(cur)
                perimeter += getPerimeter(grid, cur, c)
                q.addAll(grid.getCardinalNeighborPositions(cur).filter { grid[it]!! == c })
            }
            perimeter * connected.size
        }
    }
}
valid jetty
#

yours is somewhat readable because you used saner variable names

hoary sluice
#

an yes c and q such sane names

valid jetty
#

connected

hoary sluice
#

q makes sense but whats c

valid jetty
#

perimeter

hoary sluice
#

probably short for something that starts with c in the description

valid jetty
#

lmfao

supple whale
#

WHY VITE WHY

#

WHY THE FUCK WONT YOU FUCKING WORK

hoary sluice
#

webdev 🤮

supple whale
#

this is why i fucking hate vite

#

it makes me bald

#

they create a config for shit, which then never works

#

like whats the fucking point of alias if it doesnt work!?

#

ah ofc, vite and its infinite wisdom, "lets use 2 different bundlers, one for dev and one for prod"

#

and alias doesnt fucking work in dev

#

REEEE

hoary sluice
supple whale
#

woooo arm

#

new arm chips are fucking insane

#

i can run cyberpunk at like 30-50 fps on my SD 8g3

#

its nuts

dense sand
hoary sluice
#

@valid jetty it looks so boring without a company

#

or well, school

#

what do i put there

#

i dont care im doing it anyways

valid jetty
lucid trail
valid jetty
#

i am NOT getting hired with a profile like this but that is also not something i’m looking for

#

(yet)

supple whale
#

unironically

pearl dawn
#

rsbuild 💪

lucid trail
#

guy i confused that with roll down, there’s so many

supple whale
#

rspack is just webpack

#

but faster

#

its almost fully backwards compatible xd

hoary sluice
#

@valid jetty lets make foss circle to search

dense sand
#

least brainwashed bun fan

supple whale
#

yeah legit

#

i mean it overall isnt looking amazing for deno, i somewhat agree with that, but there's no way in fuck its going under

#

it cant, its too good

hoary sluice
valid jetty
hoary sluice
#

look at the translation

formal belfry
#

gg , almost 10k

valid jetty
#

7.5k is NOT almost 10k

formal belfry
#

well thats only 9 days lol

#

i started the project 9 days ago

valid jetty
#

whats up with these horrible recommendations recently

#

like its always videos with single digit views in my recommended

lucid trail
#

youtube has been pushing low view videos for a while now

valid jetty
#

fair enough but they could at least make it relevant

formal belfry
coarse ore
formal belfry
#

Both got hacked

valid jetty
#

who says i use windows :3

hoary sluice
#

nah dont fuck them thats disgusting

#

kill them

balmy lintel
#

everyone should use windows.

#

windows is perfect

hoary sluice
#

you are wrong ❌

formal belfry
balmy lintel
#

windows blobcatcozystars

shrewd canopy
#

Windows + WSL is better than Linux

#

Change my mind

winged mantle
#

how can you say linux is better than linux

#

checkmate

formal belfry
#

bro is 2 steps ahead

#

nickocado avocado

hoary sluice
valid jetty
#

there is no reason to use windows unless you need to use professional software like adobe stuff or you’re a game developer

winged mantle
#

i don't understand the argument

#

do you just mean you prefer windows to linux

#

or you think having both is better than just having one

#

lol

valid jetty
#

having both is also kinda worse if you’re actually productive lol

valid jetty
#

like i heard things about it fucking up partitions when there’s linux and windows at the same time

valid jetty
#

proton is really good these days

hoary sluice
#

just dont use windows like its not that hard

hoary sluice
#

to test it sure but idt the guy programming the ui needs windows

valid jetty
#

c3 headers 💔💔💔💔💔💔💔💔

jade sandal
valid jetty
#

what is c3 even about 🥀🥀

fleet cedar
valid jetty
#

no

#

it’s a mix of tabs and spaces

#

that’s why it looks like that

#

(i presume, i haven’t actually checked)

fleet cedar
#

That's even worse

valid jetty
#

💔💔💔💔

hazy pine
valid jetty
#

maybe i can add an @impl attribute

#

@impl(fmt, equals, entries) or define the dunder method yourself

indigo needle
#

add dm wallpaper plugin

balmy lintel
#

just because you asked it wont get added

#

<3

frosty obsidian
#

add brick my pc plugin

crimson sparrow
#

So proud of myself :3

hoary sluice
#

@placid cape how did u get screenshare to work on sway

balmy lintel
ornate quiver
crimson sparrow
#

:)

#

To my defense:

  1. It was one of them cheapo licenses (like $30)
  2. This computer needs to run windows
  3. I needed full bitlocker and windows sandbox
formal belfry
#

i figured that out btw @solid gazelle ty

#

:3

winged mantle
placid cape
#

I didn't :( I'm getting segfault

#

on vencord

fleet cedar
#

Impressive

jade stone
formal belfry
hoary sluice
#

literally go on ebay and use the keys on images of pcs

#

or just dont use windows

balmy lintel
#

insane person

nimble bone
#

massgrave dev

#

enjoy

crimson sparrow
#

Huh?

#

Ah right

#

Yeah, I’ve used those before

serene elk
#

should have used again

#

HWID activation has no difference from actually buying one

balmy lintel
#

so true

hoary sluice
#

how can such a big company have such absolutely insanely garbage security practices

#

its 2025 and their user passwords are unsalted

vapid flame
#

bro my vencord is crashing every now and then idk why i though its the custom css i put but its still happening when i removed it

crimson sparrow
#

Hopefully there won’t be a next time though husk

balmy lintel
elder yarrowBOT
hoary sluice
hoary sluice
#

of course it started with bad security, like most other 1900s software

#

but its 2025 and they have yet to fix any of their security

balmy lintel
#

pretty sure they allowed you to pirate windows back in the day

#

their marketing was that you could pirate it and they trusted you that youd buy it someday

#

and it worked

hoary sluice
#

ok well pretty sure they dont want you to pirate it anymore

#

actually maybe they do cause then they get more data

placid cape
hoary sluice
#

oh ok

#

same

placid cape
#

it's way cheaper on predmiumcdkeys

crimson sparrow
placid cape
#

costs 9.99€ on premiumcdkeys

crimson sparrow
#

Honestly, the goal was just to get it finished quickly

#

Bought it off kinguin because I’ve used it before

hoary sluice
#

@valid jetty elle is so nightly it doesnt have a msrv

#

icypeas

#

.is_none_or was unstable in 1.81.0

lavish cloud
#

Does anyone know a good and portable way to turn images into embeddings and then do a very fast lookup of that embedding with some kind of similarity search

#

Currently using ORB for feature descriptors but since it's variable size it's not very reliable for search

fleet cedar
#

Don't know about the embedding part

lavish cloud
#

No android support though

fleet cedar
#

That requirement wasn't listed though

#

But I thought faiss was mostly platform independent, with some dependent optimizations

valid jetty
#

it’s like a 2 line function

lavish cloud
fleet cedar
lavish cloud
#

I couldn't find a faiss impl that supported Kotlin Multiplatform at least

fleet cedar
#

Only a small number deserve a spot in std

hoary sluice
#

if youve ever looked at the kotlin stdlib youd notice a huge amount of deprecated functions and naming conflicts

#

.toLowerCase() was deprecated in favor of .lowercase(), itd be hard to find a new name for it again

#

and every time it happens its confusing

fleet cedar
#

Unlike some (most?) languages rust is very careful about what goes in std, because once there, it can never be changed

valid jetty
#

how much rigorous testing do you need for something like this lol

frosty obsidian
fleet cedar
valid jetty
#

wha

fleet cedar
#

Should take FnOnce

valid jetty
#

oh i guess

#

but im not that experienced with callbacks somebody who works on the stdlib would know that :3

dense sand
#

is anyone familiar with any rich text area component for react?

#

i need like bare minimum - only like bold/italic/underline/foreground color

hoary sluice
#

.toLowercase() is easy too but jetbrains messed it up

#

because of turkish i

#

you had toİnt

#

on turkish pcs

#

cause it used turkish locale

valid jetty
royal nymph
#

LOVE

#

ıntArrayOf

winged mantle
#

întArrayOf

valid jetty
#

いんt arrayおf

#

hiii

fleet cedar
valid jetty
#

what is that

valid jetty
#

what is the point

dense sand
#

any idea what are these figures made in?

valid jetty
#

i mean sure but it’s also kinda unsane to use dependencies for filtering lol

#

iirc bunny had a better approach being latch onto modules and perform stuff that needs them when they’re initialized lazily

#

even then, filtering for an obscure or less common module that doesn’t depend on much (or anything) is not possible with this

#

oh does that mean it initializes all the modules with those dependencies for filtering

#

ok so that’s probably not that bad but did you confirm 100% that module ids don’t change between versions

#

well then couldn’t you theoretically hard code the id for modules you need and only initialize the exact module instead of even needing to search for it

lucid trail
dense sand
valid jetty
#

oh

#

hmmm

#

why are there a bunch of empty slots

#

oh i see

#

interesting

lucid trail
valid jetty
#

suree (not that i have time to work on client mods atm lol)

hoary sluice
#

also why do the phonetic sounds for int look like the letters int

fleet cedar
#

I'm not

valid jetty
#

@hoary sluice is this you

pulsar elk
#

good afternoon people

lucid trail
shrewd canopy
hoary sluice
#

without grok tho

#

i dont pay for ai

#

Ask AI to build a compiler

#

Patiently wait, then paste each response into 5 different Rust files

#

Hit run on all five

#

Pick the one that throws the least errors

#

Iterate

#

Like a true vibe coder

fleet cedar
#

Imagine not asking your ai hive to write a script to automate the asking and copying

spark tiger
hoary sluice
#

anyways im not gonna use it

#

i dont really use ai for programming anymore either way

#

mainly the zed ai window for refactoring

lavish frigate
spark tiger
#

nah it’s cool

#

the extended token limit helped me sometimes

hoary sluice
hoary sluice
lavish frigate
#

do you think they offer their services for free because it doesnt earn them money xd

hoary sluice
#

well they are losing money

lavish frigate
#

they get more out of it because of training data and user feedback

hoary sluice
#

oh if they use my garbage language that i use in prompts thats good

#

it gets more sloppy

#

and i dont give user feedback

valid jetty
#

i wanna try to vibe code a compiler with a lexer and parser which compiles to aarch64 assembly

#

but in

#

javascript

#

so it has the highest success rate

#

i wont fix ANY errors myself

hoary sluice
#

wont wrok

#

or will be garbage and full of error

#

s

#

@valid jetty send me cloc

valid jetty
#

of what

hoary sluice
#

the cloc script

valid jetty
#

the neferious "cloc github" query to any search engine

hoary sluice
#

i thought you made it yourself

#

why does fucking cloc have triple the commits of elle

#

its in nixpkgs

#

omg

#

they put cat * | wc -l into nixpkgs

fleet cedar
#

Isn't cloc deprecated in favor of tokei?

hoary sluice
#

0 comments 🤤

valid jetty
hoary sluice
#

at least you dont have a turing complete language with variables, ifs, loops, math and a lot of sugar in 5 (FIVE) commits, one of which is initial commit

#

actually its FOUR COMMITS

#

the brother implemented an entire interpreter IN THE FIRST COMMIT

hoary sluice
#

at least you actually describe what it does

#

tbh this isnt even that bad

valid jetty
#

it is for git bisect lmao

hoary sluice
#

youre working on it by yourself and might just get sidetracked doing something else

valid jetty
#

yeah i still do that

#

but now i just unstage parts i dont want to commit

#

and make it into multiple

hoary sluice
#

ok how tf did u do all this in one day

#

im too lazy to do that

valid jetty
#

lmao

#

i kinda want elle to appear in tokei

#

im gonna pr it

hoary sluice
#

so glad noone uses .icy file extension

formal belfry
#

@valid jetty

hoary sluice
#

@valid jetty guess what

add a b = a + b
add 1 2

evaluates to

valid jetty
#

1

hoary sluice
#

nop its

λIdentifier, Identifier("a"), 41:13.Expression {
    kind: Binary {
        left: Expression {
            kind: Identifier {
                token: Identifier, Identifier("a"), 41:19,
            },
            location: 41:19,
        },
        operator: Plus, None, 41:21,
        right: Expression {
            kind: Identifier {
                token: Identifier, Identifier("b"), 41:23,
            },
            location: 41:23,
        },
    },
    location: 41:21,
}
valid jetty
#

why is there a λ

#

😭

hoary sluice
#

i wanted to it print λa.λb.a+b but i didnt make it pretty print

valid jetty
#

holy shit tokei is annoying me so much

hoary sluice
#

so now its that

valid jetty
#

they use another obsure build system called earthly with Earthfiles and i cant even bootstrap it properly on my macbook because i need docker

#

even though tokei is written in rust

#

like wtf

hoary sluice
#

ok so it actually does work but ignores the first arg

#
fn curry_assignment(
        &self,
        name: Token,
        parameters: Vec<Token>,
        body: Box<Expression>,
        location: Rc<Location>,
    ) -> Result<Expression> {
        let mut curried_lambda = Expression::new(
            ExpressionKind::Lambda {
                parameter: parameters[0].clone(),
                body,
            },
            location.clone(),
        );

        for parameter in parameters[1..].iter() {
            curried_lambda = Expression::new(
                ExpressionKind::Lambda {
                    parameter: parameter.clone(),
                    body: Box::new(curried_lambda),
                },
                location.clone(),
            )
        }

        Ok(Expression::new(
            ExpressionKind::Assignment {
                name,
                parameter: parameters.last().unwrap().clone(),
                body: Box::new(curried_lambda),
            },
            location,
        ))
    }

ignoring the clones and unwrap

#

shouldnt this work

#

does 1.. cut the first element

valid jetty
#

yeah it should

#

but i dont think you need .iter() you should be able to just & it

hoary sluice
#

im not tryna make the function idiomatic rn

#

why does it ignore the first arg

#

@valid jetty INFECTED BY ELLE BRAINROT

#

NOOOOO

valid jetty
#

LMAO

#

i do that too 😭

#

just without the !

hoary sluice
#

@fleet cedar its so over 😭

hoary sluice
valid jetty
#

husk

#

tokei is taking 2 years to build

#

we are so back it recognized elle

hoary sluice
#

scheme husk

hoary sluice
valid jetty
#

idk what |- C means

valid jetty
# hoary sluice the elle mind virus

you have no idea the number of times i encounter some bug in the compiler and i $dbg(&x) and then it takes me a solid 2 mins to figure out why theres an error

#

ok well maybe not 2 mins but yeah

hoary sluice
#

why are u typing out dbg

#

dg is so much more efficient

hoary sluice
valid jetty
#

i think im gonna get rid of those stdlib prefixes

#

ill keep $dbg and the ones for tuples but $panic and $todo is kinda bad

hoary sluice
#

@valid jetty it work

spark tiger
#

wtf is dg

valid jetty
#

yay

valid jetty
spark tiger
#

ic

hoary sluice
#

before

#

curried in the parser cause im too lazy

#

WHY IS IT NOT AN EMBED

#

before

#

i need to make a test suite

#

@valid jetty how do i do this without cloning

fn curry_assignment(
    &self,
    name: Token,
    parameters: Vec<Token>,
    body: Expression,
    location: Rc<Location>,
) -> Result<Expression> {
    let mut curried_lambda = body;

    for parameter in parameters.iter().skip(1).rev() {
        curried_lambda = Expression::new(
            ExpressionKind::Lambda {
                parameter: parameter.clone(),
                body: Box::new(curried_lambda),
            },
            location.clone(),
        )
    }

    Ok(Expression::new(
        ExpressionKind::Assignment {
            name,
            parameter: parameters[0].clone(),
            body: Box::new(curried_lambda),
        },
        location,
    ))
}
#

do i have to do refs and lifetimes

fleet cedar
#

Reverse parameters and then pop the first one, into_iter the rest

valid jetty
#

^^^

fleet cedar
#

You can also into_iter() and then next() for the first one, rev() for the rest; that might be slightly cheaper due to not actually reversing the vec

hoary sluice
#

how are you so smart

valid jetty
#

thats just how rust works lol

#

tokei hasnt had a commit in 4 months i dont think this one is getting merged

#

im just gonna put my local build of tokei into path and get rid of the one installed from brew

hoary sluice
#

brew husk

valid jetty
#

slay tho

valid jetty
#

all i will say is this is cool but good luck compiling it

hoary sluice
#

wdym

#

this is in the parser

#

it says in big bold letters feat(parser):

#

i didnt touch the interpreter

#

in this commit

valid jetty
#

i know but just in general

hoary sluice
#

so as long as i can compile a one arg function i can also compile a multi arg function

#

well i cant cause they dont exist

valid jetty
#

38 line changes is kinda crazy tho

hoary sluice
#

and this shit takes up like 8 lines or whatever (i cant count)

valid jetty
#

horror

#

its like 7

#

@fleet cedar do you know of a rust playground which also has r-a running

#

like typescript playground

fleet cedar
#

I don't know any

valid jetty
#

the one bad thing about the official one is that i dont have hover to view diag 🥲

fleet cedar
#

Just run locally for that

lucid trail
valid jetty
#

yeah i realized eventually

#

but im confused as to why it says theres md in my rust

#

i dont think there is

lucid trail
#

rustdoc?

valid jetty
#

hmm maybe

hoary sluice
lucid trail
#

yeah it is

valid jetty
#

you counted to 7

hoary sluice
#

woo

lucid trail
#

six seven??

hoary sluice
#

math finals on thursday does this mean i can integrate by parts

valid jetty
#

yep

#

expert tip

#

learn IBP via the tabular method

#

its so much easier than applying the formula especially for when you need to apply it multiple times

hoary sluice
#

i dont think we actually need to integrate

valid jetty
#

bprp my BELOVED

valid jetty
hoary sluice
#

but we need to solve ode by separation, calculate stuff with vectors, trig, solve polynomials, represent statistical models idk what the word for it is like you put a bunch of data into a spreadsheet and it tells you the regression model

hoary sluice
#

does cloc count elle

valid jetty
#

nope

#

thats why i always did git ls-files for elle in the past

hoary sluice
#

it is yea

valid jetty
#

i was learning to solve first order ODE by separation like last year in my free time xd

hoary sluice
#

on monday is hardware finals

#

or like

#

matura

#

a levers

#

levels

#

whatever

valid jetty
#

what

#

what does ANY of that mean

hoary sluice
#

Matura or its translated terms (mature, matur, maturita, maturità, Maturität, maturité, матура, érettségi) is a Latin name for the secondary school exit exam or "maturity diploma" in various European countries, including Albania, Austria, Bosnia and Herzegovina, Bulgaria, Croatia, Czech Republic, Hungary, Italy, Kosovo, Liechtenstein,...

valid jetty
#

oh

hoary sluice
#

Matura is a matriculation examination and can be compared to A-Level exams, the Abitur or the Baccalauréat.

valid jetty
#

ok so its like GCSEs

#

oh

#

ok

#

i have to pick between mechanics and stats for my a level further maths subtopic next year

#

which one do i do

#

from what i saw a level further maths mechanics is absolute hell but idk

#

@hoary sluice solve

hoary sluice
#

and basically we have to (most likely from the stuff our teacher has told us) draw a flyback converter and calculate component values, simulate a lowpass or similar simple circuit, create an equivalent circuit using thevenins theorem and the superposition theorem and maybe explain a transistor preamplifier

valid jetty
#

..........

valid jetty
hoary sluice
#

this is for math

valid jetty
#

am i done for???

valid jetty
hoary sluice
#

yuo have a translator

valid jetty
#

hes not here today

hoary sluice
#

ah ok

hoary sluice
#

this is physics

#

gn

valid jetty
#

this is further mechanics lol

#

or well its kinematics

#

whatever

formal belfry
#

my favorite gif

valid jetty
#

im crying 😭

valid jetty
#

@hoary sluice look at how fucking easy it is to render a cube in raylib

#

this is the whole code

use std/prelude;
use std/raylib;

enum Screen {
    WIDTH = 800,
    HEIGHT = 600
};

fn main() {
    rl::init_window(Screen::WIDTH, Screen::HEIGHT, "Spinning Cube");
    defer rl::close_window();

    camera := Camera3D {
        position = Vector3::from(4.0),
        target = Vector3::zero(),
        up = Vector3::xyz(0, 1, 0),
        fovy = 45,
        projection = CameraProjection::CAMERA_PERSPECTIVE,
    };

    rl::set_target_fps(60);

    while !rl::window_should_close() {
        rl::update_camera(&camera, CameraMode::CAMERA_ORBITAL);

        rl::begin_drawing();
            rl::clear_background(#cast(Color, &0xFF181818));

            rl::begin_mode_3d(camera);
                rl::draw_cube_v(Vector3::zero(), Vector3::from(2.0), #cast(Color, &0xFFC98FFC));
                rl::draw_cube_wires_v(Vector3::zero(), Vector3::from(2.0), WHITE);
            rl::end_mode_3d();
        rl::end_drawing();
    }
}
#

ofc it gets more complex if you wanna render meshes and stuff

meager bobcat
#

is there a way to go to a server (by id) directly from a url in the web version of discord
(sort of how like discord[.]com/channels/1015060230222131221/1223973149222375536 will take you to this channel)

dense sand
#

is anyone here familiar with any react highlighters which would highlight fast as you type? i tried shiki but that lags the client

#

(maybe offloading to webworker would be more performant?)

#

oh well nope

lucid trail
#

are you looking for something like monaco

dense sand
#

just highlighter

dense sand
#

Not sure, it just lags whenever i use it

#

For real time text writing

ionic lake
#

you need to offload it to a worker and dynamically use the languages and themes you need

#

not really a problem of shiki

dense sand
#

Was confident that chatgpt would do this well but seems liek not

hoary sluice
#

@valid jetty do you rip off c math lib

valid jetty
#

yea

#

along with some additional things

pearl stagBOT
# valid jetty https://github.com/acquitelol/elle/blob/rewrite/std/libc/math.le#L1-L18

math.le: Lines 1-18

global pub, external;
namespace math;

fn acos(f64 x) @alias(math::acos) -> f64;
fn asin(f64 x) @alias(math::asin) -> f64;
fn atan(f64 slope) @alias(math::atan) -> f64;
fn atan2(f64 y, f64 x) @alias(math::atan2) -> f64;
fn cos(f64 x) @alias(math::cos) -> f64;
fn cosh(f64 x) @alias(math::cosh) -> f64;
fn sin(f64 x) @alias(math::sin) -> f64;
fn sinh(f64 x) @alias(math::sinh) -> f64;
fn tan(f64 x) @alias(math::tan) -> f64;
fn tanh(f64 x) @alias(math::tanh) -> f64;
fn exp(f64 x) @alias(math::exp) -> f64;
fn frexp(f64 x, i32 *exponent) @alias(math::frexp) -> f64;
fn ldexp(f64 x, i32 exponent) @alias(math::ldexp) -> f64;
fn log(f64 x) @alias(math::log) -> f64;
fn log10(f64 x) @alias(math::log10) -> f64;
valid jetty
#

fuck wrong line

pearl stagBOT
# valid jetty https://github.com/acquitelol/elle/blob/rewrite/std/libc/math.le#L1-L28

math.le: Lines 1-28

global pub, external;
namespace math;

fn acos(f64 x) @alias(math::acos) -> f64;
fn asin(f64 x) @alias(math::asin) -> f64;
fn atan(f64 slope) @alias(math::atan) -> f64;
fn atan2(f64 y, f64 x) @alias(math::atan2) -> f64;
fn cos(f64 x) @alias(math::cos) -> f64;
fn cosh(f64 x) @alias(math::cosh) -> f64;
fn sin(f64 x) @alias(math::sin) -> f64;
fn sinh(f64 x) @alias(math::sinh) -> f64;
fn tan(f64 x) @alias(math::tan) -> f64;
fn tanh(f64 x) @alias(math::tanh) -> f64;
fn exp(f64 x) @alias(math::exp) -> f64;
fn frexp(f64 x, i32 *exponent) @alias(math::frexp) -> f64;
fn ldexp(f64 x, i32 exponent) @alias(math::ldexp) -> f64;
fn log(f64 x) @alias(math::log) -> f64;
fn log10(f64 x) @alias(math::log10) -> f64;
fn modf(f64 x, f64 *integer) @alias(math::modf) -> f64;
fn pow(f64 x, f64 y) @alias(math::pow) -> f64;
fn sqrt(f64 x) @alias(math::sqrt) -> f64;
fn ceil(f64 x) @alias(math::ceil) -> f64;
fn fabs(f64 x) @alias(math::fabs) -> f64;
fn floor(f64 x) @alias(math::floor) -> f64;
fn fmod(f64 x, f64 y) @alias(math::fmod) -> f64;
fn fmin(f64 x, f64 y) @alias(math::fmin) -> f64;
fn fmax(f64 x, f64 y) @alias(math::fmax) -> f64;
fn round(f64 x) @alias(math::round) -> f64;
valid jetty
pearl stagBOT
# valid jetty and then the extra things i made myself https://github.com/acquitelol/elle/blob/...

math.le: Lines 1-22

use std/libc/math;
global pub;

fn i64::truncate(i64 self) {
    return #cast(i32, self);
}

fn i32::promote(i32 self) {
    return #cast(i64, self);
}

fn math::atan3(f64 x, f64 y) {
    return math::atan2(y, x);
}

fn math::fact(i64 n) -> i64 {
    return n <= 1 ? 1 : n * math::fact(n - 1);
}

fn math::fclamp(f64 value, f64 min_value, f64 max_value) -> f64 {
    return math::fmax(min_value, math::fmin(value, max_value));
}
valid jetty
#

i64::truncate and i32::promote exist so you can do [1, 2, 3].map<i64>(i32::promote)

pearl stagBOT
# valid jetty oh and also the generic ones i forgor https://github.com/acquitelol/elle/blob/re...

math.le: Lines 1-45

use std/libc/math;
global pub;

external fn i64::truncate(i64 self) -> i32;
external fn i32::promote(i32 self) -> i64;

const f64 E = 2.7182818284590455348848081484902650117;
const f64 PI = 3.1415926535897932384626433832795028841;

external fn math::atan3(f64 x, f64 y) -> f64;
external fn math::fact(i64 n) -> i64;
external fn math::min(i64 a, i64 b) -> i64;
external fn math::max(i64 a, i64 b) -> i64;
external fn math::clamp(i64 value, i64 min_value, i64 max_value) -> i64;
external fn math::fclamp(f64 value, f64 min_value, f64 max_value) -> f64;

fn math::next_power_of_2<T>(T x) {
    T y = 1;

    while y < x {
        y += y;
    }

    return y;
}

fn math::sign<T>(T x) -> bool {
    return x > 0 ? 1 : -1;
}

fn math::abs<T>(T x) -> T {
    return x > 0 ? x : -x;
}

fn math::min<T>(T a, T b) -> T {
    return a < b ? a : b;
}

fn math::max<T>(T a, T b) -> T {
    return a > b ? a : b;
}

fn math::clamp<T>(T value, T min_value, T max_value) -> T {
    return math::max(min_value, math::min(value, max_value));
}
fleet cedar
#

That sign function doesn't look right

#

Why is it bool

valid jetty
#

oh true husk

#

lmfao

#

should return T

fleet cedar
#

Also sign(0) is usually 0

#

Though in math you often define sign as x/|x|, where 0 is undefined

valid jetty
#

oh interesting

#

so what should i do with my impl? make it throw if you pass in 0

fleet cedar
#

Dunno, just pick something

#

7 perhaps

#

But make sure to document it, whatever it is

valid jetty
#

does this mean it’s implementation specific for different languages

valid jetty
#

LMAO

fleet cedar
#

Most languages use 0

hoary sluice
#

youre gonna have to deprecate it when you add 3d vectors

fleet cedar
#

But I don't know if all do

valid jetty
#

but there was cases when you wanted the full range of atan

hoary sluice
valid jetty
#

so they added atan2 but it takes y, x so it’s easy to refactor y/x into y,x in your code

#

so as a joke i added atan3 to make it ordered again

fleet cedar
valid jetty
hoary sluice
#

is atan2 x/y where it takes y, x in that order?

fleet cedar
#

I don't know any definition of that

valid jetty
hoary sluice
valid jetty
#

oh

fleet cedar
valid jetty
#

^^^^

hoary sluice
#

so whats the problem

valid jetty
#

it’s ordered y, x so it’s easy to refactor

#

but i added atan3 as a joke so the arguments are in the right order

hoary sluice
#

how are they not in the right order already

#

you mean alphabetically

#

?

fleet cedar
#

Everything else ever uses (x, y)

pearl stagBOT
# valid jetty https://github.com/acquitelol/elle/blob/rewrite/std/runtime/vectors.le#L209-L234...

vectors.le: Lines 209-234

// Vector3 angle follows the following formula:
//
// cos(θ) = (v1 ⋅ v2) / (||v1|| × ||v2||)
//
// --- Where:
// v1 is the first vector
// v2 is the second vector
// θ is the angle of rotation
// × denotes the cross product
// ⋅ denotes the dot product
// ||x|| denotes the magnitude
// ----------
fn Vector3::angle(Vector3 self, Vector3 v2) {
    f32 dot = self.dot(v2);
    f32 lengths = self.length() * v2.length();

    if lengths == 0.0 {
        return 0.0;
    }

    f32 cos_theta = dot / lengths;
    cos_theta = math::fclamp(cos_theta, -1.0, 1.0);

    // Unwrap the cos(θ) into just θ
    return #cast(f32, math::acos(cos_theta));
}
hoary sluice
#

but the user doesnt see the parameter names

fleet cedar
#

User needs to remember to pass y, x rather than x, y

valid jetty
#

yeah lol

#

most of the time you just pass y,x atan3 is a joke

hoary sluice
#

isnt it more intuitive to pass numerator, denominator

valid jetty
#

idk

#

any other math function takes in x, y in that order and then there’s atan2 which takes them in opposite order

#

so i just added atan3 as a joke to fix that

#

what would that even take in lol

hoary sluice
valid jetty
#

atan4(x, y, z) = atan3(atan3(x, y), atan3(y, z))

still phoenix
hoary sluice
#

thats actually kinda confusing idk if i should use the c definition or the intuitive way

#

atana

#

atanarbirtrary

#

atanN makes more sense yea

pearl stagBOT
hoary sluice
#

does this compute the angle between the vectors from one origin or as they are currently

valid jetty
#

the vectors are not normalized if that’s what you’re asking

#

it computes the angle between the vectors as they are

hoary sluice
#

wait they are defined as from the origin

valid jetty
#

uhhh yeah

hoary sluice
#

ok nvm

valid jetty
#

x = 0, y = 0 is the origin

hoary sluice
#

i did too much vector math lately

valid jetty
#

lmao

#

the neferious node_modules

hoary sluice
#

i was asking if its the green angle or the blue angle but for it to be the green angle youd need to define each vector using Vec2 start, Vec2 end

valid jetty
#

@hoary sluice do you plan to support linking with C libs so you can do raylib stuff in icypeas

hoary sluice
#

you can just do 180-blue

valid jetty
#

why didn’t it work before lol

hoary sluice
valid jetty
#

no we weren’t lol

hoary sluice
#

and if i compile it its likely gonna be to haskell

valid jetty
#

you still need custom pages

hoary sluice
#

if you can link haskell to c which i dont think you can then sure

valid jetty
#

the neferious plugin settings page

#

we weren’t using the custom page for the other settings we were defining hardcoded new routes in their settings renderer

#

oh that

#

isn’t that kinda pointless lol

#

we’ve known how to define those for ages

#

i guess

hoary sluice
#

@valid jetty my ifs need a delimiter husk

valid jetty
#

what

hoary sluice
#

if false 1 else 2
is parsed as
if false(1) else 2

valid jetty
#

lmao

#

so now you see why i have to pick between if (x) y and if x { y }

hoary sluice
#

but im pretty sure this is solvable

#

maybe it is

#

but not purely in the parser

#

id need some kind of function analysis

#

to see if the value inside the condition is a value or a function

#

@valid jetty if then else?

#

expr if cond else expr

#

wait

#

hold on

#

this should work no?

frosty obsidian
hoary sluice
#

aka this expr if cond else expr

#

just without the ?:

frosty obsidian
#

years of using kotlin has made me really miss ? : from java

hoary sluice
#

?: is unreadable

#

but expr if cond else expr is ok

#

cause ur not meant to use if statements for large conditionals

frosty obsidian
#

ig but it gets annoying

hoary sluice
#

why

frosty obsidian
#

just more to type

hoary sluice
#

on my keyboard its easier to type if else than ? :

#

if takes 2 keypresses, ? takes 2 keypresses

#

typing : requires positionanig my thumb awkwardly to give space to my index finger

frosty obsidian
#

didn't know you used a keyboard like that

hoary sluice
#

but its really comfy

#

ifelse
i, e, and s are on the homerow

#

f and l are positioned neatly next to s

frosty obsidian
#

i can see why our opinions differ

#

on a regular qwerty layout those keys are far apart from each other

hoary sluice
#

so realistically i dont mind python-like expr if cond else expr

frosty obsidian
#

on qwerty

hoary sluice
#

i used to use qwertz where thats not the case, which probably also contributes to me not liking ?:

frosty obsidian
#

probably

hoary sluice
#

do you type ?: both with your right pinky

hoary sluice
frosty obsidian
#

i don't even think about it consciously

#

probably not actually

placid cape
#

probably the same as python

frosty obsidian
#

pointer finger

hoary sluice
frosty obsidian
#

i use my left pinky for left shift and use my right index finger for ?:

hoary sluice
#

i feel like if i use the python one id be encouraging nested ifs which i dont rly want

hoary sluice
#

they really need to put emphasis on the 10 finger system

#

in school

formal belfry
#

:3

frosty obsidian
hoary sluice
#

optimally id want schools to teach semimak jq on a split column staggered keyboard but theyre not gonna do that

formal belfry
#

oh

#

i see

frosty obsidian
#

and less readable in his opinion

hoary sluice
# formal belfry ? :

if id do ? : then itd be expr if cond else expr, i dont want to use ? : because of what wing said

formal belfry
#

ícic

frosty obsidian
formal belfry
#

i only use like

#

4 to 5 fingers to type

frosty obsidian
#

i very much struggled learning to type and i think it was because of my autism

hoary sluice
#

remember that this is a functional language that currently only uses () for math precedence and no other braces anywhere else so i dont rly wanna introduce {} for ifs

formal belfry
hoary sluice
frosty obsidian
#

actually most kids did learn

frosty obsidian
#

it didn't stick for specifically me

hoary sluice
formal belfry
frosty obsidian
#

kids nowadays aren't really taught to type but kids our age were

hoary sluice
#

and i was typing with 3 fingers on qwerty

#

it hurts to type 180 for longer than 3 seconds and its hard to do without 10 finger system

formal belfry
#

my motors suck i don't think i could do type with 10 fingers

#

autism moment

hoary sluice
#

rn i dont even have any io

formal belfry
hoary sluice
#

im basically just iteratively adding sugar to lambda calculus

#
churchTrue f s = f
churchTrue 1 2

churchFalse f s = s
churchFalse 1 2

add a b = a + b
add 4 7

addTwice f s = f + s + s
addTwice 1 10

(y $ (x $ y)) 1 2
(y $ (x $ x)) 1 2
(x $ x+2) 1

1 == 1
3 + 4
10 - 5
2 * 3
20 / 4
20 % 3
2 ** 3
5 & 3
5 | 3
5 ^ 3
7 == 7
7 != 8
3 < 10
10 <= 10
15 > 5
15 >= 15

!false
!true
-7
-(-7)

if false 1 else 2
#

did multi arg functions yesterday

#

curried in the parser which is meh but it was the easiest option

hoary sluice
#

i realized that parsing ternary would be hard

#

i have to look ahead 1 expression

#

wait thats not that hard

#
let index = self.index;
let expr = self.parse_expression()?
if !self.current_is(TokenKind::If) {
  self.index = index;
  return self.parse_binary();
}
hoary sluice
#

husk 😭 🗿 💀 blobcatscared 🐱

valid jetty
valid jetty
hoary sluice
#

should it be

valid jetty
#

this is the smartest thing ive seen in a while

#

using expr blocks for that instead of ()

#

its semantically the same you just use {} instead of ()

hoary sluice
#

itd have to be
(if cond) (then_expr) (else_expr)

#

how would i make that not ugly

valid jetty
#

just do precedence like haskell

hoary sluice
hoary sluice
#

haskell doesnt have if functions

valid jetty
hoary sluice
#

ohh

#

the humble extra case:

TokenKind::LeftParenthesis => {
    self.advance();
    let expression = self.parse_expression()?;
    if !try_consume_any!(*self, TokenKind::RightParenthesis) {
        return err!(
            ErrorKind::MissingClosingParenthesis,
            token.location,
            "Consider inserting a ')' after this expression.",
        );
    }
    Ok(expression)
}
valid jetty
#

husk

#
TokenKind::LeftParenthesis => {
    self.advance();
    let expression = self.parse_expression()?;
    if try_consume_any!(*self, TokenKind::RightParenthesis) {
        Ok(expression)
    } else {
        err!(
            ErrorKind::MissingClosingParenthesis,
            token.location,
            "Consider inserting a ')' after this expression.",
        )
    }
}
hoary sluice
#

clippy didnt clippy this

valid jetty
#

because its not smart enough for that

hoary sluice
#

also imo the first one is more readable

valid jetty
#

idk i prefer second

hoary sluice
#

would u make these 2 if conditions an else

frosty obsidian
#

i really like maple with the exception of the cursive italics

#

i built the font myself actually in order to forcefully disable them

#

since android studio doesn't let you edit font features

valid jetty
#

i love cursive italics

hoary sluice
#

i didnt like them when first looking at the font but they look nice now

frosty obsidian
#

i just don't like that its only a couple characters

#

it looks too jarring

#

could also be because i don't use ligatures as i don't like most programming ligatures

valid jetty
#

oh tbf i only like the cursive italics when in comments and in hover diagnostics

frosty obsidian
#

unfortunately I cant set up stuff like that in android studio

valid jetty
#

unfortunate

frosty obsidian
#

specifically because of font features

#

i can do different fonts for comments

#

but can't specifically enable or disable maples cursive italics

#

i only disabled the l and the k though as they were the most out of place

hoary sluice
# hoary sluice
poll_question_text

which if is better

victor_answer_votes

1

total_votes

3

median root
#

yo since when did kitty support videos in terminal what

valid jetty
#

@hoary sluice im in the deep depths of addr testing

#

look at these tests

hoary sluice
median root
#

i never realised mpv --vo=kitty was a thing

#

sad how the performance is dogshit

frosty obsidian
#

i think if you were expecting terminal video to be good thats on you

median root
#

no more firefox no more youtube just lynx and ani-cli/yt-dlp kinda thing

frosty obsidian
#

something meant to just display text just won't ever be good for something like video

#

more graphical stuff just isn't its job

median root
#

its gunna have at least 15 emojis in the readme

#

with a ton of exclamation marks

frosty obsidian
#

the kitty dev sure is trying though

valid jetty
#

@hoary sluice is this you

hoary sluice
fleet cedar
#

I have never once tried running the output from my compiler

valid jetty
#

segfault incoming

fleet cedar
#

But in my defense, I do verify that they are bytewise identical to the files they were decompiled from

pulsar elk
#

is it worth making tests and cleaning up your codebase, or should i continue being lazy

frosty obsidian
#

depends on whether or not you want to be lazy now or have a better time later

nimble bone
#

tests is this woke liberal thing, just test on prod!!

scarlet tendon
#
:arrows_counterclockwise: Updating Vencord...
HEAD is now at 578aa5f1 Experiments: Fix client crash with new experiment embed
Already up to date. 
:file_folder: Checking plugins in: /home/keira/Documents/Vencord/src/plugins/
:file_folder: Checking plugins in: /home/keira/Documents/Vencord/src/userplugins/
#!/bin/bash

echo "🔄 Updating Vencord..."
cd ~/Documents/Vencord && git reset --hard && git pull
echo ""

update_plugins() {
    PLUGIN_DIR="$1"
    echo "📁 Checking plugins in: $PLUGIN_DIR"

    for d in "$PLUGIN_DIR"*/; do
        if [ -d "$d/.git" ]; then
            plugin_name=$(basename "$d")
            echo "➡️  Forcing update on plugin: $plugin_name"
            cd "$d" && git reset --hard && git pull
            echo ""
        fi
    done
}

# Force update core plugins
update_plugins "$HOME/Documents/Vencord/src/plugins/"

# Force update user plugins
update_plugins "$HOME/Documents/Vencord/src/userplugins/"

echo "✅ All done."

for some reason it doesnt hit plugins but only userplugins

fleet cedar
#

Probably because canon plugins aren't in their own repos

scarlet tendon
#

Oh...

nimble bone
#

run git pull at the root and it updates official plugins too

#

since they come with vencord

#

userplugins tend to be in their own repos

scarlet tendon
#

So in /documents/vencord git pull updates the entire thing?

#

Woah

scarlet tendon
#

Wao

fleet cedar
#

Where else would they be?

scarlet tendon
#

Can i set my script to run every 3 hours or so and force kill vesktop

frosty obsidian
#

yeah

#

although once a day is probably enough

scarlet tendon
#

Oh cool i js setup a script for it

placid cape
hoary sluice
scarlet tendon
#

Is 251 lines of "quick" css alot

nimble bone
#

who cares

lavish frigate
scarlet tendon
#

Damn

hoary sluice
#

@valid jetty i was wondering why i was trying to parse TokenKind::If as a primary expr even tho its not a primary

#

meanwhile the neferious is_primary:

pub const fn is_primary(self) -> bool {
    matches!(
        self,
        Self::If
            | Self::Elif
            | Self::Else
            | Self::For
            | Self::While
            | Self::Do
            | Self::Loop
            | Self::Fn
            | Self::Return
            | Self::True
            | Self::False
            | Self::Null
            | Self::Identifier
            | Self::Integer
            | Self::String
    )
}
#

problem is because functions just eagerly eat anything they think might be an argument, this add 99 1 if false else 2 is evaluated as 2

#

tbh im not so sure about this expr if cond else expr thing anymore

#

so many ambiguities

valid jetty
#

horror

ionic lake
#

anyone knows why devtools lag so much now after the visual refresh

serene elk
#

feels the same for me

hoary sluice
#

@valid jetty
help

add 2 if false then 1 else 2

this is parsed as a partially applied add that takes 1 more arg and then 2 in a separate expression

#

i think

#
λIdentifier, Identifier("b"), 8:15.Expression {
    kind: Binary {
        left: Expression {
            kind: Identifier {
                token: Identifier, Identifier("a"), 8:19,
            },
            location: 8:19,
        },
        operator: Plus, None, 8:21,
        right: Expression {
            kind: Identifier {
                token: Identifier, Identifier("b"), 8:23,
            },
            location: 8:23,
        },
    },
    location: 8:21,
}
2
valid jetty
#

manti is sinning

hoary sluice
#

actually ik how to solve this

valid jetty
#

imo parse it like haskell

#

if x y else z

#

but make it so that if add 1 2 3 will count as if(add)(1)(2)(3) not if(add(1)(2)(3)) so that you have to wrap the add 1 2 in ()

hoary sluice
#

so do i

valid jetty
#

oh hm

#

but thats boringgg

hoary sluice
#

but realistically if you want to do it like its currently done then you insert a semicolon or a newline after the add 2

#

meh

#

ill do it tomorrow

valid jetty
#

now with if x then y else z you can just yield tokens until then and parse that whole thing as a condition

hoary sluice
#

i dont have time rn

valid jetty
#

its boring but its more robust i think

hoary sluice
#

the ifs work

#

but they dont have precedence over end statement

#

in a call parse

#

add 2 if false then 1 else 2
is parsed as
add 2; if false then 1 else 2

hoary sluice
valid jetty
#

keep in mind youre gonna have to remember these rules when writing your programs in aoc

hoary sluice
#

well this is not the intended way

#

and i can just insert ()

#

add 2 (if false then 1 else 2)

#

this works

#

anyways id rather prep for matura tomorrow than work on ifs rn

valid jetty
#

tomorrow is bank holiday blobcatcozystars

#

no school !!

hoary sluice
#

its not school

#

school is done

#

it doesnt count for school

#

oh and we get our report cards tomorrow so i find out if i have a 1.0 gpa or one of my teachers for some reason screwed me over and i get a 1.055 gpa

lavish frigate
#

who stole our dear manti...

#

i know manti would never stray from java...

placid cape
hoary sluice
#

@placid cape i just dug up my grades from 2021

#

why did i not kill myself

#

2 in programming (fsst)

royal nymph
#

bruder was

#

why hardware & applies math so bad

hoary sluice
#

das war vor 3 jahren in corona

royal nymph
#

why tf does ur school have islam classes

#

did u go to an islamic school or smth

hoary sluice
#

all of them do

formal belfry
#

this isnt programming wrong channel @royal nymph

royal nymph
#

the west has fallen

cinder egret
#

wrong channel @royal nymph

hoary sluice
#

der messtechnik lehrer is schon ein (ich will ihn jz ned beleidigen) aber der hätte mir das gönnen können

cinder egret
#

#🇱🇺-deutsch-german

hoary sluice
formal belfry
#

wrong channel @royal nymph

hoary sluice
#

wrong channel @formal belfry

placid cape
hoary sluice
#

iirc that was cause i didnt do her advent calendar homework

placid cape
#

oh lol

hoary sluice
#

like one task a day in december

#

and probably some missed essays

valid jetty
#

NO WONDER I CANT YIELD PLAIN STRUCTS IN VARIADICS

#

The vaarg instruction fetches the next argument from a variable argument list. It is currently limited to fetching arguments that have a base type.

#

this program

type :Foo = { w }
data $fmt = { b "%d\n", b 0 }
function w $foo(...) {
@start
    %args =l alloc8 32
    vastart %args
    # this line breaks C abi
    %x =l vaarg %args
    # should be:
    # %x =:Foo vaarg %args
    # vaarg only supports base tys though
    %field =w loadw %x
    %tmp =l call $printf(l $fmt, ..., w %field)
    ret 0
}
export function w $main() {
@start
    %struct.Foo =l alloc8 4
    storew 123, %struct.Foo
    %tmp =w call $foo(..., :Foo %struct.Foo)
    ret 0
}
#

no wonder it doesnt work qbe just straight up doesnt support it

karmic turtle
valid jetty
#

oh my god every time i look at structs internally i just get more and more confused

#

i think i understand it and i look and it just makes less and less sense as i go deeper

valid jetty
#

valid C program btw

#include <stdio.h>
#include <stdarg.h>

typedef struct {
    int x;
} Foo;

void print(int n, ...) {
    va_list args;
    va_start(args, 0);  
    Foo x = va_arg(args, Foo);
    printf("%p\n", x);
    va_end(args);
}

int main() {
    Foo x = { 39 };
    printf("%p\n", x);
    print(0, x);
    return 0;
}
#

not possible in qbe because you cant fetch aggregate types

#

"Full support for the C ABI."

#

maybe there is a way and im stupid

valid jetty
#

ok i give up

#

no matter what i do the data isnt copied

#

i just get a 0 initialized buffer of the same size

formal belfry
#

rosie speaks a language nobody on this planet can comprehend

#

our minds are too naive and feeble to comprehend Elle talk

dense sand
#

Is there any way i could encode efficiently a series of numbers into a 1 32bit integer?

hoary sluice
#

u mean a bit stream ?

dense sand
#

Its a stack like structure and each number is like 2 bits. The thing is that it has to be arbitrary length

fleet cedar
#

You can encode 16 2-bit numbers in a u32

dense sand
#

Yea just by bit shifts right

#

But its not limited to 16

fleet cedar
#

Possibly more depending on distribution

frosty obsidian
#

yeah can store 32 1 bit numbers in a u32 integer

dense sand
#

💀

frosty obsidian
#

little known fact

jade stone
frosty obsidian
#

discord permissions used to be stored in a u32

#

now its u64

dense sand
#

You might know im making a jvm and i need a way to store operand stack values. The thing is that there are instructions which require you to know what type of element the top value is(long and double take 2 operand stack entries) and i have no idea on how to figure this out without any sort of metadata

frosty obsidian
#

i think you might need metadata

#

even kotlin had to store its own metadata

fleet cedar
#

Why would you need metadata, the instruction itself says what type it expects

#

Though you might need metadata for the gc to know whether something is a pointer or not, unless you're just gonna do "yup looks like a pointer let's go"

dense sand
#

Look at dup_x2 instruction for exmaple

frosty obsidian
#

i assume metadata is needed for some more atypical things

fleet cedar
#

Doesn't need any metadata for that

dense sand
#

I dont get that

#

It has 2 forms

#

And you need to know one of the etrnies computational type

fleet cedar
#

Why

#

It's just 8 bytes in both "forms"

dense sand
#

I might be just stupid in that case

#

In my old version i was having a metadata field beside the actual value which made all the entries larger for hopefully no reason

velvet fog
#

((((HE KNOWS PYTHON))))

timber root
balmy lintel
dense sand
#

Id dm him with a leetcode

velvet fog
hazy pine
#

ahh yess indeed

dense sand
#

why the fuck does this slow my whole website so much

lavish frigate
#

there can me many causes

#

but if you use react its most likely to be a component unnecessarily updating/not cleaning up in useeffect

ionic lake
nimble bone
#

you should definitely try filtering styles

ionic lake
#

how do you mean?

nimble bone
#

just type something it'll be insanely laggy

#

also happens on web but better

ionic lake
#

oh yeah

royal nymph
royal nymph
ionic lake
#

that's true but it was managable atleast

#

now it has increased like 15%

royal nymph
#

what we theorised is that it might be because of the big amount of sources

dense sand
ionic lake
#

don't use all the languages

#

dynamically load them on the fly

dense sand
#

how tf do i do that

ionic lake
#

the docs even tell you that

#

ill tell in a bit

royal nymph
ionic lake
#

yes thats what the export does

royal nymph
#

does that only contain the language names or does it contain all the translated strings in all languages

#

assuming this is localisation

ionic lake
#

but its like import("shiki/languages/${lang}")

royal nymph
#

oh it's shiki

ionic lake
#

its shiki

royal nymph
#

yeah still don't load everything into memory

#

you probably wanna create a separate file for each language and lazy load them

maybe create one bundle with all the most popular languages and load that ahead of time

dense sand
#

theres like 200 languages wdym lazy load them in each separate file 😭

ionic lake
dense sand
#

but this wont solve what i need though? i want the user to have option to select whwat language highlighting he wants and then apply it, idk if its possible to lazy load each like this

valid jetty
#

NO MORE GARBAGE VALUES

#

@hoary sluice WE WIN

#

2 changes:

  • when storing something at an address, if the value were storing is a struct i blit the bytes there instead of assigning the address directly (this was just incorrect behavior)
  • when passing arguments to a variadic function, if its the non-required arguments all parameters are into_base'd which means the struct decays purely to its pointer which fixes the ABI breakage
#

SO GOOD

#

YOU CAN STORE STRUCTS INLINE NOW

hoary sluice
#

@valid jetty @placid cape im so angy

valid jetty
#

qbe said NOTHING about variadic arguments passed needing to be non-abi

hoary sluice
#

religion teacher gave me a 2 for absolutely no reason

valid jetty
#

horror

#

what does that make your gpa

hoary sluice
#

i wasnt in school 4 times cause of open door day at uni / sick / train cancelled but hes not even allowed to grade that cause its not my fault

valid jetty
#

1.083 GPA ouch

hoary sluice
#

so its still 1.0

valid jetty
#

oh

hoary sluice
#

but its ugly

valid jetty
#

oh ok thats fine then surely

hoary sluice
#

and im gonna complain

valid jetty
#

lmfao

hoary sluice
#

i mean noone cares about gpa

#

in high school

#

or anywhere

#

good thing is today was hardware matura and i def passed and i never have to do hardware ever again

dense sand
#

@supple whale if you have javascript object, is it possible to pass it down to C with emscripten?

valid jetty
valid jetty
#

ie c struct to js