Elmord's Magic Valley

Computers, languages, and computer languages. Às vezes em Português, sometimes in English.

Posts com a tag: life

Updates on Fenius and life

2024-03-26 15:19 +0000. Tags: comp, prog, pldesign, fenius, lisp, life, in-english


Over the last couple of months (but mainly over the last four weeks or so), I’ve been working on the Fenius interpreter, refactoring it and adding features. The latest significant feature was the ability to import Common Lisp packages, and support for keyword arguments in a Common-Lisp-compatible way, i.e., f(x, y=z) ends up invoking (f x :y z), i.e., f with three arguments, x, the keyword :y, and z. Although this can lead to weird results if keyword arguments are passed where positional arguments are expected or vice-versa (a keyword like :y may end up being interpreted as a regular positional value rather than as the key of the next argument), the semantics is exactly the same as in Common Lisp, which means we can call Common Lisp functions from Fenius (and vice-versa) transparently. Coupled with the ability to import Common Lisp packages, this means that we can write some useful pieces of code even though Fenius still doesn’t have much in its standard library. For example, this little script accepts HTTP requests and responds with a message and the parsed data from the request headers (yes, I know that it’s not even close to fully supporting the HTTP standard, but this is just a demonstration of what can be done):

# Import the Common Lisp standard functions, as well as SBCL's socket library.
let lisp = importLispPackage("COMMON-LISP")
let sockets = importLispPackage("SB-BSD-SOCKETS")

# We need a few Common Lisp keywords (think of it as constants)
# to pass to the socket library.
let STREAM = getLispValue("KEYWORD", "STREAM")
let TCP = getLispValue("KEYWORD", "TCP")

# Import an internal function from the Fenius interpreter.
# This should be exposed in the Fenius standard library, but we don't have much
# of a standard library yet.
let makePort = getLispFunction("FENIUS", "MAKE-PORT")

# Add a `split` method to the builtin `Str` class.
# This syntax is provisional (as is most of the language anyway).
# `@key start=0` defines a keyword argument `start` with default value 0.
method (self: Str).split(separator, @key start=0) = {
    if start > self.charCount() {
    } else {
        let position = lisp.search(separator, self, start2=start)
        let end = (if position == [] then self.charCount() else position)
            lisp.subseq(self, start, end),
            self.split(separator, start=end+separator.charCount()),

# Listen to TCP port 8000 and wait for requests.
let main() = {
    let socket = sockets.makeInetSocket(STREAM, TCP)
    sockets.socketBind(socket, (0,0,0,0), 8000)
    sockets.socketListen(socket, 10)


# Process one request and call itself recursively to loop.
let serveRequests(socket) = {
    print("Accepting connections...")

    let client = sockets.socketAccept(socket)
    print("Client: ", client)
    let clientStream = sockets.socketMakeStream(client, input=true, output=true)
    let clientPort = makePort(stream=clientStream, path="<client>")
    let request = parseRequest(clientPort)

    clientPort.print("HTTP/1.0 200 OK")
    clientPort.print("Hello from Fenius!")



# Remove the "\r" from HTTP headers. We don't have "\r" syntax yet, so we call
# Common Lisp's `(code-char 13)` to get us a \r character (ASCII value 13).
let strip(text) = lisp.remove(lisp.codeChar(13), text)

# Define a structure to contain data about an HTTP request.
# `@key` defines the constructor as taking keyword (rather than positional) arguments.
record HttpRequest(@key method, path, headers)

# Read an HTTP request from the client socket and return an HttpRequest value.
let parseRequest(port) = {
    let firstLine = strip(port.readLine()).split(" ")
    let method = firstLine[0]
    let path = firstLine[1]
    let protocolVersion = firstLine[2]

    let headers = parseHeaders(port)

    HttpRequest(method=method, path=path, headers=headers)

# Parse the headers of an HTTP request.
let parseHeaders(port) = {
    let line = strip(port.readLine())
    if line == "" {
    } else {
        let items = line.split(": ") # todo: split only once
        let key = items[0]
        let value = items[1]
        lisp.cons((key, value), parseHeaders(port))


Having reached this stage, it’s easier for me to just start trying to use the language to write small programs and get an idea of what is missing, what works well and what doesn’t, and so on.

One open question going forward is how much I should lean on Common Lisp compatibility. In one direction, I might go all-in into compatibility and integration into the Common Lisp ecosystem. This would give Fenius easy access to a whole lot of existing libraries, but on the other hand would limit how much we can deviate from Common Lisp semantics, and the language might end up being not much more than a skin over Common Lisp, albeit with a cleaner standard library. That might actually be a useful thing in itself, considering the success of ReasonML (which is basically a skin over OCaml).

In the opposite direction, I might try to not rely on Common Lisp too much, which means having to write more libraries instead of using existing ones, but also opens up the way for a future standalone Fenius implementation.


I quit my job about 6 months ago. My plan was to relax a bit and work on Fenius (among other things), but I’ve only been able to really start working on it regularly over the last month. I’ve been mostly recovering from burnout, and only recently have started to get back my motivation to sit down and code things. I’ve also been reading stuff on Old Chinese (and watching a lot of great videos from Nathan Hill’s channel), and re-reading some Le Guin books, as well as visiting and hosting friends and family.

I would like to go on with this sabbatical of sorts, but unfortunately money is finite, my apartment rental contract ends by the end of July, and the feudal lord wants to raise the rent by over 40%, which means I will have to (1) get a job in the upcoming months, and (2) probably move out of Lisbon. I’m thinking of trying to find some kind of part-time job, or go freelancing, so I have extra time and braincells to work on my personal projects. We will see how this plays out.


That’s all for now, folks! See you next time with more thoughts on Fenius and other shenanigans.

Comentários / Comments

I was burnt out and I did not know it

2023-01-01 17:09 +0000. Tags: life, mind, about, in-english

In the last few months of 2020, I started working on a Go implementation of Fenius, my hobby programming language. I worked roughly every week on it, at some points working almost every day on it. By December 2020, I had a working prototype, with basic support for functions, data structures, and even macros. The project looked quite promising; from there, I could have kept iterating on it until it turned into something usable.

But then I stopped.

The motivation was gone. I touched the project again in April 2021, tried to refactor it a bit, but that was it. I have not touched it again since.

This did not really have anything to do with the project itself. I was extremely tired in general a lot of the time, with very little motivation to work on side projects. I have posted only two blog posts in 2021, and only two in 2022 again. It’s not entirely clear to me why this happened. I think it was a combination of the isolation of living alone away from family during the pandemic, an unsatisfying situation at work, and other personal reasons.

I’ve recently switched jobs. I quit my previous job in the beginning of November, and started the new one in December. I had a one-month gap between the two to recover some of my brain cells; this seems so far ago that I barely remember what I did during this time. I visited a friend for a few days, I watched lots of videos and listened to podcasts, but I think I largely did nothing during much of this time. And I don’t regret it. I spent the first week of December in Berlin getting to know the people at the new company, and now I’m back to Lisbon working remotely.

I don’t feel extremely tired all the time anymore. This is particularly notable because my general habits have not changed. I still eat mostly the same stuff (and suffer from the same IBS symptoms as always); I still do as much physical activity as before; I still sleep roughly as badly as usual (although now that I think about it, I think I have been waking up less often during the night). And yet I go through most days without feeling physically tired or exhausted. I still have trouble finding motivation to focus on projects outside work, but I don’t feel exhausted all the time the way I did before.

I’m beginning to realize now the degree of burnout I was going through before. During all that time, I thought I was near the edge of burnout, but I did not think I actually had burnout because I was still able to get stuff done, and because I knew many of my colleagues were going through worse stuff at work. But comparing how I’m feeling then and now, not only mentally but even physically, it’s clear now how bad it was back then. Whether this really fit a medical diagnosis of ‘burnout’, I can’t say for sure, but it doesn’t really matter. I know how I was feeling then and how I’m feeling now, and the word people choose to apply to that is not that relevant.

This experience serves as a lesson for the future: I will pay more attention to the symptoms, and earlier, should this happen again.

Given that I can begin to think about doing things after work again, what about side projects? Honestly, most of these hobby projects I discuss in this blog end up being sort of vaporware and not becoming anything usable. And honestly, the main thing I plan to change is to stop feeling bad about it. It’s okay. The world is not in a pressing need for a new programming language or a new shell. The computing world can take care of itself. But these projects are fun to work on anyway. I can learn a lot by working on those things, and if I can share a little bit of what I learn with you through this blog (or elsewhere), that’s probably more useful than the projects themselves. And not everything we do has to be useful anyway. I am reminded of the words of Alan Perlis:

“I think that it’s extraordinarily important that we in computer science keep fun in computing. When it started out, it was an awful lot of fun. Of course, the paying customers got shafted every now and then, and after a while we began to take their complaints seriously. We began to feel as if we really were responsible for the successful, error-free perfect use of these machines. I don’t think we are. I think we’re responsible for stretching them, setting them off in new directions, and keeping fun in the house. I hope the field of computer science never loses its sense of fun. Above all, I hope we don’t become missionaries. Don’t feel as if you’re Bible salesmen. The world has too many of those already. What you know about computing other people will learn. Don’t feel as if the key to successful computing is only in your hands. What’s in your hands, I think and hope, is intelligence: the ability to see the machine as more than when you were first led up to it, that you can make it more.”

In 2023, I hope to be able to play a little bit more with these projects, to discuss my ideas about them in this blog even if they don’t go anywhere, to share a little bit of what I learn, and overall, to worry less about stuff. But I also hope to spend more time away from computers, reading books, singing, trying to play instruments, and even out there in the (shudder) Real World.

I wish everyone a Happy New Year, and may we live fulfilling lives, whatever that means for each one of us.

2 comentários / comments


2020-03-19 22:53 +0000. Tags: about, life, mind, ramble, in-english

It's been a while since I last posted here. Many things have happened in the meantime, including a global pandemic. But also a move to Lisbon, a new job, and meeting lots of great people. Not a bad beginning of year, on balance.

Life has not been quite the piece of cake either. Every person has their problems, ghosts and flaws that we have to learn to overcome and to live with – those things are not mutually exclusive, really. Turns out you can practice both self-compassion and self-improvement.

This blog has been around for 8 years now. I'm glad it has lasted so long, and I hope it lasts yet longer. My presence in various social networks has waxed and waned over the years, but this blog (and the website as a whole) has been my permanent corner on the Internet. A consistent bit of life (and a good one at that) across changes in residence (six, if I count correctly), jobs, moving from academia to industry, and now moving from one country to another. Readership has also been relatively consistent – small but consistent – and I'm glad to have you fellow readers to share stuff with.

I hope to start posting more frequently here again. I'll be happy if I succeed in posting at least once or twice per month, but I won't promise any numbers.

As the first post of 2020, I'll finish with a late new year, but timely equinox resolution:

To not live ruled by fear.

Wish everyone a happy equinox, and may the sun shine for us in complicated times.

1 comentário / comment

More blogging, less twittering

2019-09-09 22:33 -0300. Tags: life, mind, about, in-english

It's been a while since I last posted on this blog. I've been travelling, and also interviewing for a new job; I'll have more to say about that in the future. Now that things have settled down a bit, I intend to start blogging more again.

Aside from that, I intend to start spending less time on Twitter. I've long been in a love/hate relationship with Twitter, and the hate side of it is starting to win out, for a variety of reasons:

Mastodon isn't much better. It does not have some of Twitter's misfeatures, such as trying to push a non-chronological timeline onto users, and it has the advantages of being decentralized and community-oriented, but the experience is very similar to that of Twitter. I think these problems are related to the media of microblogging, rather than a specific platform.

Traditional blogs can be addictive too. I follow hundreds of blogs via RSS, and sometimes I feel like refreshing my feeds every now and then to see if there is something new. But blog posts typically take more time to write, so updates are not so frequent, so the incentive to keep refreshing them several times a day is not so strong. It's also easier to keep track of unread posts and read them at a later time. Finally, blog posts tend to be much more informationally nutritious than tweets or toots.

At the same time I start to use Twitter less, I would like to start posting more here. I still have to figure out what to do with content that seems too short for a blog post – for example, if I just want to share a link to a video, or a little command I learned. One solution is to accumulate those and post them in weekly installments. Another is just to go ahead and post short posts, but I don't really want to pollute the blog with a plethora of micro-posts. Yet another is to create a separate page for the micro-posts. I'm currently more inclined towards the first option.

That's it, folks. Have a nice week!

3 comentários / comments

I am chaos, and I tell you that you are free

2018-12-19 00:16 -0200. Tags: random, life, mind, em-portugues

[…] This was on the fifth night, and when they slept that night each had a vivid dream of a splendid woman whose eyes were as soft as feather and as deep as eternity itself, and whose body was the spectacular dance of atoms and universes. Pyrotechnics of pure energy formed her flowing hair, and rainbows manifested and dissolved as she spoke in a warm and gentle voice:

I have come to tell you that you are free. Many ages ago, My consciousness left man, that he might develop himself. I return to find this development approaching completion, but hindered by fear and by misunderstanding.

You have built for yourselves psychic suits of armor, and clad in them, your vision is restricted, your movements are clumsy and painful, your skin is bruised, and your spirit is broiled in the sun.

I am chaos. I am the substance from which your artists and scientists build rhythms. I am the spirit with which your children and clowns laugh in happy anarchy. I am chaos. I am alive, and I tell you that you are free.

Principia Discordia, pages 00008-00009.

Comentários / Comments

Remember what I told you / If they hated me they will hate you

2018-10-08 21:39 -0300. Tags: music, politics, life, mind, em-portugues

Faz uns dias que essa música anda na minha cabeça (letra, tradução).

I'll just leave this here.

Comentários / Comments

(finish-output mestrado)

2018-01-30 22:27 -0200. Tags: life, academia, mestrado, em-portugues

Gandalf: "Excellent work, Frodo. You defeated Sauron and now... hm! Now everyone can have happy lives forever. Thanks to you."

Frodo: "I know. I just wish... I could forget."

The Lord Of The Rings (1944)flyingmoose.org

Leitouros e leitouras,

Pous que o infindável mestrado findou-se. Ainda falta a homologação da secretaria e da comissão da pós (e é por isso que é um finish-output e não um close), mas, tendo recebido o joinha da banca, orientadores e biblioteca, creio que só o que me resta agora é começar a rodar o garbage collector mental para desentupir o cérebro, e fazer a dança da vitória.

A monografia, para quem (insanamente) quiser ver, está aqui.

11 comentários / comments

Resolução de ano novo

2018-01-01 22:55 -0200. Tags: life, mind, about, em-portugues

Eu não sou muito fã de resoluções de ano novo, por uma variedade de motivos, mas como resolução tentativa de ano novo eu escolho a seguinte:

Preocupar-se com as coisas que importam, e não se preocupar com as coisas que não importam.

Obviamente, o que importa e o que não importa é inteiramente subjetivo. Mas isso não importa.

Desejo a todos um feliz ano novo, e espero em breve voltar a escrever mais por aqui.

1 comentário / comment

Some thoughts on Twitter and Mastodon

2017-06-25 01:32 -0300. Tags: comp, web, privacy, freedom, life, mind, in-english

Since the last post I've been using Mastodon as my primary microblogging platform for posting, but I was still regularly reading and retweeting stuff on Twitter. A while ago Twitter started reordering tweets in my timeline despite my having disabled that option, just as I said could eventually happen (except much earlier than I expected). The option is still there and is still disabled, it's just being ignored.

Twitter brought me much rejoicing during the years I used it. I follow a lot of cool people there and I've had lots of nice interactions there. I found myself asking if I should accept some abuse from Twitter to keep interacting with those people, and I've been shocked at myself for even asking myself that. I've been using Twitter less and less as of late. (I'd like to be able to say I did it out of principles, but to be completely truthful I find the non-chronological timeline utterly annoying, and that has had as much to do with my leaving as principles.)

Although I switched to Mastodon as my Twitter replacement, Mastodon is not really "another Twitter". Having 500 rather than 140 characters to write initially felt like learning to talk again. Early on when I started using Mastodon, I was going to reply to a person's toot (that's what posts are called in Mastodon) with a short, not-really-one-full-sentence line that is the norm in Twitter. I wrote it down and was like "no, this kind of grunting a half-thought is not going to cut it here". It felt like Twitter's 140 character limit not only limited the kinds of things you could say, but also imposed/favored a "140-character mindset" of not finishing lines of thought or thinking with much depth. As I went on using Mastodon, I found myself writing thoughts I wouldn't have even tried to write in Twitter.

I still open up Twitter once in a while. Today I opened the mobile version in my desktop browser and noticed that the mobile version still shows a chronological timeline, still doesn't pollute the timeline with liked-but-not-retweeted tweets, and is much faster and cleaner than the desktop version. (I still have to un-fix the navigation bar via CSS, but I already had to do that in the desktop version anyway.) It's tempting to start using Twitter again through the mobile version, while it doesn't catch up with the new "features". I know I shouldn't, though. Even if the mobile version never caught up with the misfeatures (I suppose it eventually will, probably in short time), Twitter has already shown they're willing to throw stuff down their users' throats in the name of – what? I'm not even sure. Maybe they want to make Twitter more Facebook-like to attract Facebook users, even if that means alienating the people who used Twitter exactly because it was not like Facebook?

The funny thing is Twitter could simply provide some options for users to control their experience ("(don't) show tweets liked by your followers", "(don't) show tweets you liked to your followers", "(don't) reorder tweets" (the last one is already there, it just doesn't work)). This way they could cater to whatever new audience they have in mind and keep the users who liked how Twitter used to work. They just don't care to. I'm not really sure what are the motivations and goals behind Twitter's actions. For a really long time before the last changes it had been showing the "you might like" box (even if you clicked the "show me less like this" option (the only way to dismiss it) every time) and the "you might like to follow" box (even if you dismissed that too, and even though it also showed undimissable follow suggestions on the right pane anyway). I used to open Twitter pretty much every day, so it didn't really make sense as a user retention strategy. Maybe they want to incentivize people to do specific things on Twitter, e.g., throw in more data about themselves? (Yeah, there was the "add your birthday to your profile" periodic thing too.)


3 comentários / comments

Essa vida mulambda

2016-09-14 23:23 -0300. Tags: about, life, mind, em-portugues

Pois então, galera. Faz um bocado de tempo que eu não dou as caras por estas terras de Entre-Douro-e-Minho, por uma porção de motivos.


Eu comecei a trabalhar no final de julho, o que me deixou com menos tempo livre para dedicar às atividades blogareiras. Além disso, eu chego em casa com variáveis graus de cansaço, e conseqüentemente menos inclinado a sentar e escrever. (Ultimamente eu tenho chegado menos cansado do que inicialmente, talvez porque eu agora eu já tenha me acostumado melhor com a rotina. Mas eu ainda continuo chegando com uma certa dose de zonzeira na cabeça, o que eu desconfio que tem mais a ver com o barulho do ônibus e do ar-condicionado do serviço do que com cansaço em si, mas ainda não testei essa hipótese.)

Quanto ao trabalho, está sendo bem bacaninha. Estou trabalhando como desenvolvedor Python, que das linguagens mais mainstream acho que é a que eu mais gosto, e tenho aprendido bastante coisa sobre as tecnologias da modinha (plot twist: elas são úteis). A única coisa não muito empolgante é que estamos trabalhando sobre uma codebase herdada de uma outra empresa, e que foi desenvolvida usando técnicas de programação um tanto quanto, digamos, interessantes.

Outra coisa que eu descobri por lá é que o futuro do subjuntivo irregular ("fizer", "tiver", etc.) está mais morto do que eu pensava, mas isso é assunto para outra ocasião.


Outra coisa que eu tinha (e tenho) tomando meu tempo livre é o mestrado, e o tempo que não era comido pelas atividades do mestrado era comido pela preocupação de achar que devia estar fazendo as atividades do mestrado. Depois de ter tido um segfault na cabeça no fim-de-semana retrasado tentando terminar um paper para semana passada, eu decidi parar de me preocupar com o mestrado por enquanto, o que em termos de saúde mental parece ter sido uma ótima decisão. Eu pretendia falar um pouco mais sobre a situação do mestrado, mas acho que vai ficar para depois de eu o ter concluído (ou de eu ter sido chutado dele por timeout).

Mudança de workflow

Normalmente, meu workflow para escrever um post é: (1) pegar um tópico; (2) escrever sobre o tópico até exaustão (tanto do tópico quanto do autor) por qualquer quantidade de tempo entre duas e oito horas; (3) reler o post (com variáveis graus de exaustividade) para ver se ficou algum erro de digitação ou redação; (4) publicar o post (e descobrir erros depois anyway). Às vezes eu até começo em um dia e continuo em um outro, mas no geral vai tudo em uma sentada. Uma conseqüência disso é que eu já sei de antemão que escrever um post vai tomar um bocado de tempo, então eu acabo só me sentindo inclinado a escrever quando eu sei que vou ter rios de tempo livre sem interrupções. (Outra conseqüência disso são os famosos posts de 20k, tão apreciados pelos leitores.)

Agora que eu não tenho mais rios de tempo livre contíguo com tanta freqüência, esse workflow está sendo um tanto quanto sub-ótimo (vide quantidade de posts nos últimos dois meses). Estou pensando se não é o caso de eu começar a escrever posts menores e splitar tópicos em múltiplos posts, mas não sei até que ponto isso é uma boa idéia. Faz umas semanas que eu tenho pensado em escrever um post sobre alguns fatos [que eu acho] interessantes sobre os números nas línguas indo-européias, mas isso é um post que tomaria bastante tempo tanto para a escrita em si quanto para pesquisar/conferir os fatos antes de escrever. Não sei se faz sentido separar o tópico em múltiplos posts e ir postando uma série de posts pequenos, ou se é melhor escrever um post só em várias sentadas e publicar tudo de uma vez no fim do ano. Eu prefiro ler esse tipo de informação toda de uma vez, mas eu sei que pelo menos alguns dos leitores não partilham da mesma preferência. (On the other hand, eu não sei se esses mesmos leitores leriam a mesma informação espalhada em múltiplos posts. So there's that.)

Mas essa é a sua opinião, ele já tem outra opinião, ué. Qual a sua opinião?

On another note

Unrelated com qualquer coisa, por ser ano eleitoral, eu implementei a mui lendária e prometida lista de comentários recentes na sidebar do blog no domingo passado. Espero que ela traga muitas alegrias a todos. Votem em mim para déspota universal.

12 comentários / comments

Main menu

Recent posts

Recent comments


em-portugues (213) comp (152) prog (74) in-english (66) life (49) pldesign (40) unix (39) lang (32) random (28) about (28) mind (26) lisp (25) fenius (22) mundane (22) web (20) ramble (18) img (13) hel (12) rant (12) privacy (10) scheme (10) freedom (8) copyright (7) bash (7) esperanto (7) academia (7) lash (7) music (7) shell (6) mestrado (6) home (6) misc (5) emacs (5) android (5) conlang (5) worldly (4) php (4) book (4) editor (4) latex (4) etymology (4) politics (4) c (3) tour-de-scheme (3) network (3) film (3) kbd (3) ruby (3) wrong (3) security (3) llvm (2) poem (2) wm (2) cook (2) philosophy (2) treta (2) audio (2) comic (2) x11 (2) lows (2) physics (2) german (1) ai (1) perl (1) golang (1) translation (1) wayland (1) en-esperanto (1) old-chinese (1) kindle (1) pointless (1)


Quod vide

Copyright © 2010-2024 Vítor De Araújo
O conteúdo deste blog, a menos que de outra forma especificado, pode ser utilizado segundo os termos da licença Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International.

Powered by Blognir.