HackerTrans
TopNewTrendsCommentsPastAskShowJobs

pcfwik

no profile record

Submissions

Why do we do astrophysics?

arxiv.org
3 points·by pcfwik·25 giorni fa·0 comments

Stand and Deliver Revisited

reason.com
4 points·by pcfwik·mese scorso·0 comments

An Introduction to Objectivist-C

fdiv.net
1 points·by pcfwik·2 mesi fa·0 comments

Rewrite System Showdown: Stochastic Search vs. EqSat

arxiv.org
1 points·by pcfwik·2 mesi fa·0 comments

Left-Leaning Red-Black Trees Considered Harmful

read.seas.harvard.edu
4 points·by pcfwik·4 mesi fa·0 comments

Report from Vietnam (1968) Walter Cronkite [video]

youtube.com
1 points·by pcfwik·4 mesi fa·0 comments

Logarithmic Mean

en.wikipedia.org
2 points·by pcfwik·5 mesi fa·0 comments

Jim Roskind on C Ambiguity

pdos.csail.mit.edu
4 points·by pcfwik·5 mesi fa·0 comments

Stephenson Impersonator; Minor Update

nealstephenson.substack.com
3 points·by pcfwik·5 mesi fa·0 comments

Designing a Programming Language for the Desert

futhark-lang.org
2 points·by pcfwik·6 mesi fa·0 comments

250 Years Ago: Thomas Paine's Common Sense

blogs.loc.gov
3 points·by pcfwik·6 mesi fa·1 comments

Identity Theft in AI Conference Peer Review

cacm.acm.org
1 points·by pcfwik·7 mesi fa·0 comments

Fix: Externalizing network I/O in serverless computing [pdf]

arxiv.org
1 points·by pcfwik·8 mesi fa·0 comments

A ritual and the toxic effects of ranking

mailchi.mp
2 points·by pcfwik·9 mesi fa·0 comments

The Unix Executable as a Smalltalk Method [pdf]

programmingmadecomplicated.wordpress.com
148 points·by pcfwik·9 mesi fa·21 comments

Four Steps to the Apocalypse: A talk at 60th anniversary of MIT's Project Mac [video]

youtube.com
3 points·by pcfwik·10 mesi fa·1 comments

comments

pcfwik
·7 mesi fa·discuss
Since this is about C declarations: for anyone who (like me) had the misfortune of learning the so-called "spiral rule" in college rather than being taught how declarations in C work, below are some links that explain the "declaration follows use" idea that (AFAIK) is the true philosophy behind C declaration syntax (and significantly easier to remember/read/write).

TL;DR: you declare a variable in C _in exactly the same way you would use it:_ if you know how to use a variable, then you know how to read and write a declaration for it.

https://eigenstate.org/notes/c-decl https://news.ycombinator.com/item?id=12775966
pcfwik
·9 mesi fa·discuss
Oh awesome, thanks for the pointer!
pcfwik
·9 mesi fa·discuss
I once considered Wren for a situation where I (to a first approximation) wanted to allow users to write 'plugins' that link against my internal C application symbols but using a language focusing more on ease of use (rather than C).

Unfortunately, neither Wren nor any of the other major 'embeddable scripting languages' (e.g., Lua) were really a good fit for this, because they commit fully to the 'all-numbers-are-floats' thing and generally don't seem to even try to provide a general equivalent to the C++ `extern "C" { ... }` thing.

Of course, I know this isn't really the target use case of Wren/Lua/etc., but if anyone knows of a good embeddable scripting language for this I'd love to hear about it. Eventually I went with CPython (which provides ctypes to solve my problem) but it's a huge pain to embed properly.
pcfwik
·9 mesi fa·discuss
FWIW --- programmer dvorak lets you type () without "shift" but both ~ and ^ require shift. https://www.kaufmann.no/roland/dvorak/
pcfwik
·10 mesi fa·discuss
Re: visualizations of lambda terms, also see "To Dissect a Mockingbird" https://dkeenan.com/Lambda/
pcfwik
·10 mesi fa·discuss
makes sense, thanks --- cool project!
pcfwik
·10 mesi fa·discuss
Also find it interesting that you're allowing out-of-bounds pointer arithmetic as long as no dereference happens, which is a class of UB compilers have been known to exploit ( https://stackoverflow.com/questions/23683029/is-gccs-option-... ). Do you disable such optimizations inside LLVM, or does Fil-C avoid this entirely by breaking pointers into pointer base + integer offset (in which case I wonder if you're missing out on any optimizations that work specifically on pointers)?
pcfwik
·10 mesi fa·discuss
Given the goal is to work with existing C programs (which already have free(...) calls "carefully" placed), and you're already keeping separate bounds info for every pointer, I wonder why you chose to go with a full GC rather than lock-and-key style temporal checking[1]? The latter would make memory usage more predictable and avoid the performance overhead and scheduling headaches of a GC.

Perhaps storing the key would take too much space, or checking it would take too much time, or storing it would cause race condition issues in a multithreaded setting?

[1] https://acg.cis.upenn.edu/papers/ismm10_cets.pdf
pcfwik
·10 mesi fa·discuss
To add another suggestion for understanding the Fourier transform, personally the first explanation that ever clicked with me was the Aho/Hopcroft/Ullman algorithms textbook.

Rather than talking about sine and cosine waves, they motivate the Fourier transform entirely in terms of polynomials. Imagine you want to multiply two polynomials (p(x) and q(x)). The key is to recognize that there are two ways to represent each polynomial:

1. "Coefficient form," as a set of coefficients [p_0, p_1, p_2, ..., p_d] where p(x) = p_0 + p_1x + p_2x^2 + ... + p_dx^d, OR

2. "Sample form," as a set of sampled points from each polynomial, like [(0, p(0)), (1, p(1)), (2, p(2)), ..., (d, p(d))]

Now, naive multiplication of p(x) and q(x) in coefficient form takes O(d^2) scalar multiplications to get the coefficients of p(x)q(x). But if you have p(x) and q(x) in sample form, it's clear that the sample form of p(x)q(x) is just [(0, p(0)q(0)), (1, p(1)q(1)), ...], which requires only O(d) multiplications!

As long as you have enough sample points relative to the degree, these two representations are equivalent (two points uniquely defines a line, three a quadratic, four a cubic, etc.). The (inverse) Fourier transform is just a function that witnesses this equivalence, i.e., maps from representation (1) to representation (2) (and vice-versa). If the sample points are chosen cleverly (not just 1/2/3/...) it actually becomes possible to compute the Fourier transform in O(d log d) time with a DP-style algorithm (the FFT).

So, long story short, if you want to multiply p(x) and q(x), it's best to first convert them to "sample" form (O(d log d) time using the FFT), then multiply the sample forms pointwise to get the sample form of p(x)q(x) (O(d) time), and then finally convert them back to the "coefficient" form (O(d log d) using the inverse FFT).