Andy

u/Andy@programming.dev
260 posts · 375 comments

Recent posts

Recent comments

I live in a place with a lot of traffic violence, and there's negligible enforcement. I'm looking for a practical way to keep drivers accountable and reduce the violence.

I think cameras on the intersections have to be part of that strategy. I'm inclined to believe a responsible implementation is possible, and I'd like to see more discussion of what that could look like.

Thanks! I'm currently using DozeCal (which defaults to base 12 on every launch, which is fun, but not usually what I want), and 48sx, which is cool but I don't know how to use it well, and some common actions are buried.

on *Permanently Deleted* · c/linux · 3 pts · 1y

It is very good, and I am currently using it. I don't like its dependencies on GTK stuff, the developer is a little picky about what to support, and I dislike the +options style. Other than that, 👍 .

Also great: Wezterm, Konsole, Rio. I'm excitedly following Rio's development, which has a much smaller dependency list, and hopping back and forth between it and Ghostty/Wezterm. But it's still got some things to iron out and features to develop.

A bit from the readme appreciating concatenative programming:

The Joy language introduced concatenative functional programming. This generally means a stack based virtual machine, and a program consisting of words which are functions taking an input stack and returning an output stack. The natural syntax that results is postfix. Over a very long time I have come to feel that syntax gets in between me and the power in a language. Postfix is the least syntax possible.

There are several reasons I like the concatenative style of programming:

  • Function composition is concatenation.

  • Pipelining values through functions to get new values is the most natural idiom.

  • Functions are applied from left to right instead of inside out.

  • Support for multiple return values comes for free.

  • No need for operator precedence.

  • Fewer delimiters are required:

    • Parentheses are not needed to control operator precedence.
    • Semicolons are not needed to separate statements.
    • Commas are not needed to separate arguments.

(Note: Sapf is inspired by, but is not purely a concatenative language because it has lexical variables.)

When I am programming interactively, I most often find myself in the situation where I have a value and I want to transform it to something else. The thing to do is apply a function with some parameters. With concatenative programming this is very natural. You string along several words and get a new value.

It's been a while, but my clumsy adding of a comment to the buffer is unnecessary, given zle -M, which will display a message outside of the buffer. So here's an updated version:

# -- Run input if single line, otherwise insert newline --
# Key: enter
# Credit: https://programming.dev/comment/2479198
.zle_accept-except-multiline () {
  if [[ $BUFFER != *$'\n'* ]] {
    zle .accept-line
    return
  } else {
    zle .self-insert-unmeta
    zle -M 'Use alt+enter to submit this multiline input'
  }
}
zle -N       .zle_accept-except-multiline
bindkey '^M' .zle_accept-except-multiline  # Enter

# -- Run input if multiline, otherwise insert newline --
# Key: alt+enter
# Credit: https://programming.dev/comment/2479198
.zle_accept-only-multiline () {
  if [[ $BUFFER == *$'\n'* ]] {
    zle .accept-line
  } else {
    zle .self-insert-unmeta
  }
}
zle -N         .zle_accept-only-multiline
bindkey '^[^M' .zle_accept-only-multiline  # Enter