ristos's comments

ristos | 1 month ago | on: My Gripes with Prolog

Oh ok, you're referring to assignment as one expression, not the PLT definition of expression, which for that example would be like 3-6 expressions depending on whether you consider x, list, and 1 to be expressions. Yeah, a complicted formula might be more verbose in prolog because there's no return statements, it's all unification, but I think that's a feature not a bug, because it allows you to create bidirectional formulas and also naturally extends to "multiple return values" in a sense, because everything is a relation.

ristos | 1 month ago | on: My Gripes with Prolog

No functions:

You can't do length + 1 as a single expression in any language though, in python for example len(ls) + 1 is two expressions, but I get what you mean, it is a little less terse. But those commas in prolog are super useful. And you can make your example bidirectional too:

``` :- use_module(library(clpfd)).

foo(List, X) :- length(List, Out), X #= Out + 1. ```

``` ?- foo(X, 3). X = [_, _] .

?- foo(X, 3), X = [a,b]. X = [a, b] . ```

-----

No standarized collection types:

I think that's a feature rather than a bug. The ability to just use infix and compound terms in a generic way without it being tied to a clause or operator is a huge feature. For example:

``` pets(dog-rex-poodle, dog-fluffy-bishon). ```

That defines the collection in a semantic or mathematical sort of way, then you can pass that into whatever data structure you want, whether it's a ordered map or a hashmap or whatever.

----

No boolean values:

That's also a feature in prolog, same as having no null. It's the same sort of motivation for Haskell's Maybe and Either types or Rust's Option and Result types, same kind of usefulness.

----

Cuts are confusing:

Conditionals don't need to use cuts, the modern prolog way of doing it is using the reif library:

``` :- use_module(library(reif)).

if_(Cond, Then, Else) ```

For example:

``` :- use_module(library(clpfd)). :- use_module(library(reif)).

sign(X, S) :- if_(X #> 0, S = pos, S = nonpos). ```

---

Non-cuts are confusing:

This isn't doing what you're thinking:

``` \+ (A = B) ```

It's unifying A with B, `A = B` unifies. You want `dif(A, B)`.

----

Straying outside of default queries is confusing:

It might be tempting to use bagof, but it's not monotonic. You should try to write as much prolog code as you can in a pure, monotonic way, so your code can take advantage of prolog's unique advantages, like monotonic debugging.

Check out the SWI prolog discourse group, there's a lot of good stuff in there and everyone's very supportive to newbies. And Markus Triska's website and youtube channel Power of Prolog is a super useful resource for all this stuff, a good place to go if you want to know what sets prolog apart. A lot of prolog's usefulness doesn't show up as an embedded language either, like minikanren isn't "pretty much prolog", it lacks a lot of stuff that prolog offers. Multiparadigm programming languages are also really popular now, but a lot of what sets programming languages apart isn't what they can do, it's what they can't do, what sort of paradigm or way of thinking they force you to adopt.

ristos | 10 months ago | on: Ask HN: How do you talk about past jobs you regret in interviews?

I'm not sure how you would handle your specific situation, but my general take on interviews is that the interviewer isn't just screening you, in the sense that they want to know what you did and your skillset and skill level, they're also trying to figure out how well you can navigate interpersonal politics. And the problem is that for a lot of people those two things seem contradictory, because with interpersonal politics we'll intentionally spin things just slightly, not like a politician but just to maintain a good vibe and keep everyone comfortable and engaged. Like imagine if you were in a social gathering, and there's also a girl you like in there that you're trying to impress, and someone asked you about that previous role, you wouldn't drift off into a rant or anything negative because you don't want to kill the vibes of the meeting, you want to look your best because there's a girl you like there, so maybe you'd say something like "ah, it just wasn't a good fit". And if that came up while you were dating that girl you like, and she wanted to dig deeper on it, you wouldn't just repeat the same thing, because it would look like you're being evasive and she would then be on the defensive because she would've felt like she's prying too much, and it would kill the vibe, you'd just say something a little bit more, also keeping it short, and maybe mention something good about working there that you learned, and then not forcefully but try to make some room to move to another subject, or if you can do it slickly without making it feel awkward then you just shift to some other topic that feels engaging without making it look evasive. Again, it's all about maintaining a good vibe. And companies want to know the ins and outs about you, but they also just want to know that you have some social skills in doing stuff like that, because they're running a company with different kinds of people, sometimes from very different backgrounds, and they need the team to work together and feel cohesive. The company and the management are already trying to keep the company afloat and profitable, it's own engineering problem, on top of marketing, on top of operational concerns, they don't want to have concerns around political drama in the office, they want to know that you can be cool. Unless you're a boy genius from Southie, then maybe they'll tolerate a lot of weird shit from you, but you aren't a boy genius from Southie.

ristos | 11 months ago | on: Has the decline of knowledge work begun?

There does seem to be a sort of sampling bias thing that I've only recently noticed, that I think does come from being older now. I started to get back into old retro games I used to play, and I can't help but realize how many games back then were really bad, like not worth playing at all, and I just cherry picked the good ones. And being older, I'm not into gaming anymore, or really much of a consumer at all besides essential goods, being younger you do consume more entertainment products, like games. So I think there's definitely some sampling bias going on here where things look like they're getting worse. Or it could be both things, like it could actually be getting worse, but also not as much as it looks like because of this sort of sampling bias thing. Like having to have multiple accounts, like a Switch account plus some special Switch account and/or another account to play a game, or you buy a game and then there's an online store as well, or you buy a game in person but you can't get a copy digitally, or you buy a digital copy and you can't get a physical copy made for you for a flat fee, or that increasingly people don't actually literally own things anymore and it's all subscriptions or some sort of permission to use, or that a lot of games are just remakes of older games, or that you can't play single player offline, or that you can't transfer or give your digital game that you "bought" and "own" to someone else (less it be a physical copy, obviously), etc.

ristos | 1 year ago | on: Suckless.org: software that sucks less

I don't know, the problem with that mentality is that you can't just separate the art from the artist, right? unless we're talking about historical figures, on some level it's validating and enabling those people and their ideology, even if you explicitly disagree with it.

I'm pretty bummed out to hear about all of this. I thought the suckless style software was pretty cool, easy to grok, minimalist. I use a lot of it. Granted, I've been planning on translating all of the minimalist C software I've been using to R7RS scheme, so maybe this just gives me more motivation to get started on porting my stack to that.

Someone in an earlier thread said something like, if he avoided software written by assholes then he would have a hard time using his computer, something like that. I think that's kind of true, but there are definitely red lines when it comes to violent ideologies.

ristos | 1 year ago | on: Our phones are killing our ability to feel sexy (2024)

Idk, popular people and probably influencer types look cool with a phone. They look like a VIP, people are constantly texting them, it looks like they're constantly socializing, networking, etc. Same with social media, they have like 5 million friends and it looks like a lot's going on in their lives.

That's probably the difference between how cool people use technology vs nerds or dorks. When I use my phone, it's either to look something up, study or learn something new, read the news, or talk to my mom. I would imagine I probably don't look cool using my phone.

Joking aside, I think one thing that I really don't like about smartphones and texting entering our lives is that when you're out for food or coffee people get on their phones, and it feels antisocial, like you can't talk to them now without interrupting them from whatever they're doing on their phone. In the past, I remember, if people had nothing to say, they would just sit there and look off into the distance. It all felt way more social back then, when people got together they interacted more.

ristos | 1 year ago | on: When did estimates turn into deadlines?

Nobody is going to fix the problem without fixing the culture, which isn't easy to do.

The issue isn't around tasks that are predictable in nature and therefore easy to estimate with a small margin of error, it's around complexity in software, unforeseen things, bugs, etc, which can compound for larger long term projects.

If engineers give estimates close to what it would be if everything goes right, then they risk overpromising and underdelivering if something goes wrong (hofstader's law). They might've just wanted to do the right thing by saving the company money and time, but in the end they footgunned themselves.

Or engineers intentionally over-estimate in order to manage the complexity, but then you end up with a lot of padding and parkinson's law. Because as soon as the engineer starts underpromising and overdelivering consistently, management will pressure them to lower their estimates because they have a track record of doing that, so instead they're incentivized to pad and then fill up the entire time they estimated even if it took less time.

Sprints were probably invented in order to deal with some of these issues, so that people just work with a bunch of smaller tickets that are much easier to estimate, with the more complex long term estimates going to management, which are incentivized to get it right because they're shareholders. That often leads to micromanagement and burnout, and it doesn't fix the padding/overestimation issue either, it might even amplify it in a lot of cases.

People here mention giving ranges or probability distributions, and have also equally mentioned that they don't work because management wants a single number, or management just assumes the best-case or middle-case of the range as the actual estimate, and then they still get in trouble for giving ranges and it didn't solve anything. It also doesn't solve the problem of unanticipated setbacks, the whole you don't know what you don't know thing, which can only really be solved culturally in some way.

While there are certainly bad managers that want to squeeze their workers, a lot of the time management is probably also pressured to give estimates and that's why they want and need that accuracy, because they're pressured by investors and clients that want to know how much time and money something will cost.

Overall the entire problem is a system cultural issue around managing complexity.

ristos | 1 year ago | on: When did estimates turn into deadlines?

I could see that working well for managers, if they incentivize estimates as biweekly or monthly bonuses going to the most accurate one, and each person gives a detailed estimate of ballpark plus probability of what sorts of things can go wrong and how that impacts the estimate.

ristos | 1 year ago | on: Everything Is Just Functions: 1 week with David Beazley and SICP

The arrow and page up/down keys don't work in any predictable pattern for me, it's really weird. Like I thought it only scrolled up and down with the arrow keys if I press it 4 times, but then page up/down keys don't work no matter how many times I press it, then I focus on the page and it works, but then the arrow keys take 6 times to press before moving, and then I tried the same pattern again, and the arrow keys now take 11 presses before they start moving. Usually a lot of modern apps predictably break the back/forward history buttons and tab focus, but I've never seen anything quite like this. I guess it must be still delivering value though even if the product isn't polished.

ristos | 1 year ago | on: Please stop the coding challenges

Companies aren't incentivized to eliminate false negatives in hiring (talented people getting overlooked), they just need to make sure there are no false positives (bad hires). I'm guessing it's probably rare for companies to think about the bigger picture, like the long term health of the economy and nation, where it's actually really bad if there are a bunch of really talented people that are being underutilized.

If I were interviewer, I'd probably do a coding assignment that builds on an already existing mini codebase, quarter or half day assignment (2-4 hours), with a strict time limit to turn it in by the end of the allotted time. It would test for someone's ability to read unfamiliar codebases, with the codebase being reasonably small for the little time that's available, and the ability to build features on top of it, to write clean readable code compatible with the codebase, etc. And an a 30-60 minute more open-ended informal knowledge interview to gauge how knowledgeable the candidate is and where their strengths and weaknesses are. And previous work would probably be a good indicator, like open source work and/or previous job experience.

ristos | 1 year ago | on: Ask HN: If you were rewriting Emacs from scratch, what would you do differently?

I wish it were built with a very small, minimal core, that was just the TUI with the lisp machine like functionality, scriptable using R7RS scheme instead of elisp. And then everything else is built on top in a more modular fashion, with "battery packs" that install many modular components into one higher level functionality, like an IDE.

I'd like to eventually write something like this, there are a lot of things it would enable that you just can't do with emacs. It would be an emacs killer if implemented well, but it would also open up a whole new set of possibilities.

I don't know how far I'd get just working on it on my free time, which is competing for time with other projects. I'm looking for funding for these sorts of projects. If anyone reading this is an investor and interested in funding this sort of thing, please reach out.

ristos | 1 year ago | on: Can logic programming be liberated from predicates and backtracking? [pdf]

There already is a pretty major effort around the prolog community to build everything as much as possible around pure, monotonic prolog, and to provide a means to support multiple search strategies depending on the best fit for the problem. CLP libraries are also pretty common and the go-to for representing algebraic expressions relationally and declaratively.

I wouldn't say that the logic or relational way of describing effects is a bad thing either. By design it allows for multiple return values (foo/1, foo/2, ...) you can build higher level predicates that return multiple resources, which is pretty common for many programs. It makes concatenative (compositional) style programming really straightforward, especially for more complex interweaving, which also ends up being quite common. Many prolog implementations also support shift/reset, so that you can easily build things like conditions and restarts, algebraic effects, and/or debugging facilities on top. Prolog is also homoiconic in a unique way compared to lisp, and it's quite nice because the pattern matching is so powerful. Prolog really is one of the best languages I ever learned, I wish it was more popular. I think prolog implementations need a better C FFI interop and a nicer library ecosystem. Trealla has a good C FFI.

I think logic programming is the future, and a lot of these problems with prolog are fixable. If it's not going to be prolog, it'll probably be something like kanren and datalog within a lisp like scheme or clojure(script).

This is a great resource for getting a good feel of prolog: https://www.youtube.com/@ThePowerOfProlog/videos

ristos | 1 year ago | on: First Report on the Pre-Scheme Restoration

Very nice!

I'm looking to use prescheme for low level code that needs more precise control where chibi scheme or guile isn't a good fit. I'm also hoping at some point that I have the time to write a borrow checker on top of prescheme, which might be a subset of prescheme but would still fit many use cases, so that it can be used instead of Rust. And also to create a transpilation step that creates optimizations, that would then ideally be proved. And then that way the borrow checked code with optimizations can be all transpiled by prescheme into C, and then tiny c compiler can compile it unoptimized into straightforward assembly. The goal would be to have verified code that can also be easily hand audited as well. LLMs just make all this stuff so much more possible because of how much faster we can iterate. Fun times for coding!

ristos | 1 year ago | on: AI won't replace human devs anytime soon

I feel like the hype around LLMs replacing dev work is similar to what happened years ago when they were saying the same thing about scripting languages and WYSIWYG editors like Dreamweaver...

What ended up happening in practice is just that time was saved on grunt work, and really engineers just ended up working on composing and debugging higher level components, optimization, or low level work.

ristos | 1 year ago | on: Why my apps will soon be gone from the Google Play Store

> Now the new API adds fine-grained access and removes complete access. > What are they gonna do? Give the old gallery app fake file access, making it completely useless?

Can you elaborate on your example here? Couldn't they just do something like replace oldGalleryAppOpensOrWritesToAnyPlace() to askPermissionsForWhichFilesAndFoldersCanBeWrittenTo() or ifSensitiveDirIsNoLongerAccessibleAskPermissionOnWhichFolderToUseForCompat() ?

ristos | 1 year ago | on: Optimizing Guile Scheme

The monomorphic vs polymorphic argument is an interesting one. I think that you could explicitly get unboxing if you used something like CLOS style multimethods to dispatch based on the type, so that (add <float> <float>) would dispatch to the function that uses fadd on those operands. I never realized that you could use this kind functionality, multimethods or free monad interpreters, to write in-code optimizations that are conveniently abstracted away in actual code usage.

Edit: nevermind, that's also dynamic dispatch. You'd have to add static dispatch via macros or some external transpilation step.

page 1