HN user

vq

700 karma
Posts13
Comments86
View on HN

TI-83 was built on Z80 as well. I remember hand-assembling a program for it with pen and paper, something I did earlier with the Sinclairs.

And Haskell is an ensemble of rainbows. It's very fun and pretty to look at.

Type classes can smooth over some of it but it's not unusual to have to do some plumbing.

I didn't consider inlining but I believe you're correct, you could regain the optimisation for this example since the function is non-recursive and the application is shallow. The GHC optimisation I had in mind is like the opposite of inlining, it factors out a common part out of a lambda expression that doesn't depend on the variable.

I don't believe inlining can take you to the exact same place though. Thinking about explicit INLINE pragmas, I envision that if you were to implement your partial function application sugar you would have to decide whether the output of your sugar is marked INLINE and either way you choose would be a compromise, right? The compromise with Haskell and curried functions today is that the programmer has to consider the order of arguments, it only works in one direction but on the other hand the optimisation is very dependable.

One slightly contrived example would be if you had a function that returned the point of a set closest to another given point.

getClosest :: Set Point -> Point -> Point

You could imagine getClosest build a quadtree internally and that tree wouldn't depend on the second argument. I say slightly contrived because I would probably prefer to make the tree explicit if this was important.

Another example would be if you were wrapping a C-library but were exposing a pure interface. Say you had to create some object and lock a mutex for the first argument but the second was safe. If this was a function intended to be passed to higher-order functions then you might avoid a lot of unnecessary lock contention.

You may be able to achieve something like this with optimisations of your explicit syntax, but argument order is relevant for this. I don't immediately see how it would be achieved without compiling a function for every permutation of the arguments.

One "feature of currying" in Haskell that isn't mentioned in the fine article is that parts of the function may not be dependent on the last argument(s) and only needs to be evaluated once over many application of the last argument(s) which can be very useful when partially applied functions are passed to higher-order functions.

Functions can be done explicitly written to do this or it can be achieved through compiler optimisation.

Emacs is practically a product of AI research.

Even if it didn't, it's distributed with a psychotherapist mode, hippie-expand (which I use almost every day) and dabbrev.

I maintain a couple of Debian servers and this is how I do it too.

Reverse proxy, DB, etc from Debian. The application server is built and deployed with nix. The Python version (and all the dependencies) that runs the application server is the tagged one in my nix flake which is the same used in the development environment.

I make sure that PostgreSQL is never upgraded past what is available in the latest Debian stable on any on the dev machines.

I work almost exclusively in Emacs without the modern LSP-based tools. I believe I do keep more in my head than programmers that use more advanced IDEs.

In code I have control over myself I avoid imports that doesn't enumerate all imported symbols. That is I always use the import Library (symbol) syntax in Haskell and never do wildcard import in Python.

When coding C I sometimes use tags so that I can go to definitions quickly, I should probably use it more than I do to be honest.

I do use hippie-expand for quick auto-completion but it is completely textual, it has no understanding of the programming language it currently works on which makes it much less powerful of course but it also has some benefits.

I always have the documentation very reachable, I use a search keyword in my browser to search on hoogle. I type H <Space> symbol/type-expression <Enter> and I quickly find the documentation.

I do use Visual Studio on a Windows box for working on a C# codebase a couple of times per year and when I do I always turn off that code lens thing and I find that I rely on the code navigation features quite a bit. Part of it is probably due to it being a code base that is larger and that C#(/Java)-flavoured OOP makes the code more spread out. In terser languages like Haskell (which is much terser) it is natural for more functionality or types to live in the same file which means that you get much further with just simple textual search.

My python+numpy+matplotlib version from when I was playing around with it:

  import numpy as np
  import matplotlib.pyplot as plt
  n = 2048
  X, Y = np.mgrid[:n,:n]
  plt.imshow(X^Y, cmap=plt.cm.Spectral)
  plt.show()

I doubt there could ever be something official, but for me (and others,) nixpkgs serves as a central source for a huge amount of C and C++ code.

I'm closing in on 15 years of git usage as well.

Before that for a short period I really wanted to get into darcs, the first DVCS I used. I was constantly confused about what commands to use to rectify the off-the-happy-path situations that you find yourself in every now and then. The UI might have been better than git's in a lot of ways but it was distinctly higher-level.

When I learned git and understood the underlying model I had far fewer problems. The commands of early git could have been designed better, but they were more transparent in what they did.

The thought haven't struck me before, but maybe one of the great things about git is that even the low-level/plumbing commands (cat-files/ls-tree/show-ref) have well written man pages.

I always run small mutations like that in a transaction.

  BEGIN;
  DELETE FROM product WHERE id=123;
  ROLLBACK;
  --COMMIT;
And then I remove/comment the ROLLBACK and enable the COMMIT when I'm confident it's correct. This way I also get the number of affected rows for the statement.

I do this even on the command line but it's handier in an Emacs buffer and for busy databases you then don't need to worry about other transactions and locking while you type.

I didn't know about C-x SPC, thanks for the tip!

I enjoyed your article but I think the solution for me is to leave TMM disabled, though it makes me curious about what else I've missed in the last decade(s). You just made a sale of your book.

I do too.

I'm one of those weirdos that disable transient-mark-mode because I don't feel like it does the right thing for all situations where you use mark. Sometimes I want to use mark like a cheap bookmark and C-x C-x between mark and point, sometimes I use the rectangle commands and for those transient-mark-mode only makes things worse.

(I know the CUA mode has some fancy rectangle features, but that's not for me)