[-] 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 ;

3
submitted 4 months ago* (last edited 4 months ago) by Tushta@programming.dev to c/concatenative@programming.dev

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

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

7

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 4 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 4 points 10 months ago

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

36
submitted 10 months ago by Tushta@programming.dev to c/linux@lemmy.ml

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)

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 10 points 11 months ago

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.

[-] Tushta@programming.dev 21 points 1 year ago

Gasp Don't remind me how old I'm getting. Joel's blog was really big deal, upto ~15 years ago when he stopped blogging. He and Jeff Atwood created Stack Overflow.

54

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 ›

Tushta

joined 1 year ago