Tushta

joined 1 year ago
[–] Tushta@programming.dev 2 points 4 months ago

Thanks to johnb on the Factor's discord channel I got answers to these two questions:

In terms of nicer way to do a nested map nicely, fried quotations are the answer:

'[ _ map ] map

and in order to call a quotation inside a word definition, one needs to use call( stack effect ) form:

: nested-map ( a quote -- a' ) '[ _ '[ _ call( x -- x' ) ] map ] map ;

 

I wanted to map over a nested array in factor so I created a helper function:

: nested-map ( a quote -- a' ) swap [ over map ] map nip ;

which i then called with

{ { 1 2 } { 3 4 } } [ 1 + ] nested-map

But when I call it I get the error from the title.

If I just paste the body of the function it works as intended:

{ { 1 2 } { 3 4 } } [ 1 + ] swap [ over map ] map nip

So I guess I have two questions: is there a better way to achieve the original goal, but also how am I supposed to create higher order functions without getting this error?

[–] Tushta@programming.dev 2 points 6 months ago (1 children)

Nisam ni znao da /c/Serbia postoji dok mi nije iskocio ovaj post :)

 

I'm building a PC for my wife to do photo editing / retouching / other 2d/non moving stuff. I'm aware that this kind of software does benefit from GPU acceleration, but I'm also under impression that it's not critical. One additional constraint is that it should fit into teenage engineering's computer-1 case, because orange. I'm personally having a preference for AMD stuff, but I could be talked out of it. Two similarly priced options I had in mind were:

  • Ryzen 5600 / 16G ram / radeon 6600 GPU
  • Ryzen 8600G / 32G ram / no gpu

Thoughts / suggestions?

[–] Tushta@programming.dev 3 points 7 months ago

I mean, yeah, but that's on the level of "because they're eucaryote" like us and all plants and animals, as opposed to bacteria which are procaryote. It's not really some freakish similarities.

[–] Tushta@programming.dev 1 points 10 months ago

I have a Windows dual boot, and Windows did install some updates, and Lenovo site indicates that the latest BIOS version was released mid November, so that could be it.

[–] Tushta@programming.dev 2 points 10 months ago

running sleepgraph crashes the computer same way deep sleep does 😖

[–] Tushta@programming.dev 1 points 10 months ago

Yeah, if the bracket is on deep, it crashes and enter the BIOS recovery thingy. If it's s2idle, it does what it says on the tin.

[–] Tushta@programming.dev 3 points 10 months ago

No, hibernation saves state to disk, and turns the computer off, drawing no power. Deep sleep is what was for me just sleep until recently: it uses power to keep data in ram, so it's faster to wake up than hibernation. The amount of power used is really small, so unless you don't use your lap top for a couple of days, it won't deplete the battery. New hardware has this new "S2 Idle" state, that is basically an "On" state minus the screen and it's OS's job to try to use as little power as possible usually by telling each and every device to chill as much as possible (this is my understanding, but don't quote me on this). On Windows, with the first party device drivers, this sorta works OK + OS drops to deep sleep or hibernation depending on battery or something.

[–] Tushta@programming.dev 1 points 10 months ago (2 children)

It's 2021 Lenovo ThinkBoot 15 G2 Intl with Intel i3-1115G4, 8GB onboard ram, integrated GPU and two NVME slots.

Here are some lines from dmidecode if they mean anything to anyone:

Getting SMBIOS data from sysfs.
SMBIOS 3.3.0 present.
Handle 0x0000, DMI type 0, 26 bytes
BIOS Information
        Vendor: LENOVO
        Version: F8CN42WW(V2.05)
        Release Date: 06/28/2021
        Address: 0xE0000
        Runtime Size: 128 kB
        ROM Size: 16 MB
        Characteristics:
                PCI is supported
                BIOS is upgradeable
                BIOS shadowing is allowed
                ACPI is supported
                USB legacy is supported
                BIOS boot specification is supported
                Targeted content distribution is supported
                UEFI is supported
        BIOS Revision: 2.42
        Firmware Revision: 2.42

Handle 0x0001, DMI type 1, 27 bytes
System Information
        Manufacturer: LENOVO
        Product Name: 20VE
        Version: ThinkBook 15 G2 ITL
        SKU Number: LENOVO_MT_20VE_BU_idea_FM_ThinkBook 15 G2 ITL
        Family: ThinkBook 15 G2 ITL

Handle 0x0002, DMI type 2, 15 bytes
Base Board Information
        Manufacturer: LENOVO
        Product Name: LNVNB161216
        Version: SDK0J40700 WIN
[–] Tushta@programming.dev 4 points 10 months ago

So... Bios update broke deep sleep, because fuck you, that's why?

 

I was running KDE Neon on ThinkBook 15 G2 and had deep sleep working after adding mem_sleep_default=deep to GRUB_CMDLINE. It worked for a while until it didn't. I didn't do anything other than running regulat updates. Since couple weeks back, when going to sleep, it shows BIOS Recovery progress bar or something and restarts.

I switched to Debian and the behavior is the same. S2 sleep is next to useless as it drains something like 10% battery / hour, and the lap top is warm to touch.

[–] Tushta@programming.dev 56 points 10 months ago* (last edited 10 months ago) (1 children)

Vucic literally spent a year illegally registering people from outside of Belgrade (including Serbs from Bosnia and Croatia) to Belgrade addresses and bussed them on the election day to vote, just so he could narrowly win local elections. That is the main outrage. These protests aren't even organized by opposition parties, people are just that pissed.

[–] Tushta@programming.dev 13 points 11 months ago (1 children)

There are no suits in this game, so no limit of how many cards of a same kind can be in a hand. Five of a kind is explicitly mentioned in the rules of the game.

 

There is a commonly shared view in the programming community that algorithm puzzles are something you do to prep for an interview and than you never use in the actual job. This certainly rings true as in 15 years of programming, i feel I can count on fingers the number of times I needed to stop and think about data structure / algorithm, rather than usual workload of thinking about what's even the problem being solved; how to structure code; what's the interface at the module/service/package boundary; how to make code testable/maintainable/flexible etc... Iterating though a list or a dict is all ds/algo you'll need 99% of the time.

FF to now when I'm on a burnout induced sabbatical, and after a while I got itchy to write some code again. Problem was that all the ideas for projects I'd like to do are, well... projects. I still don't feel like digging through manuals for libraries and frameworks and writing boilerplate and doing all the things that need to be done to push things through. Anyhow, I was sitting in a coffee shop with my illustrator friend, who, at some point, just pulled out a notebook, spent 20-ish minutes drawing something that caught his eye and was like: "that's it for today". That's it... 20 minutes, it's done, tomorrow something else, new blank page... So I got into puzzles. Now, the first thing I do in the morning is solving a daily puzzle on leet code. If I feel like it, I might also do problems from an old competition. And I'm having a blast!

Which brings us to the question from the title: is there a direction I can push this forward? I mean, I don't mind this just being fun, but I was curious, is there something out there in the "Real World" that I'm missing that is closer to this kind of problem solving from what i was doing so far?

view more: next ›