Latest Tech News

Stay updated with the latest in technology, AI, cybersecurity, and more

Filtered by: functions Clear Filter

What's the difference between named functions and arrow functions in JavaScript?

Arrow functions (also known as ‘rocket’ functions) are concise and convenient. However, they have subtle differences compared to function declarations and function expressions. So how do you know which one to use, and when? Function declarations and function statements We have (at least) three ways of creating functions in JavaScript. The first is the function declaration. This binds a function to a given name. It looks something like this:1 1 I’ve used String.toLowercase() here, partly for b

Asynchronous Error Handling Is Hard

(Ed. note: This article was originally published on The CUDA Handbook blog on November 2, 2023.) Every API designer has struggled with the question of how best to propagate errors to their callers, since before the term “API” was invented. Even decades ago (say 30+ years), interface designers knew to separate the error return from the payload, in functions that return other results to their caller. Since it is sometimes useful to know what not to do: My favorite example of an antipattern in th

Bloom Filters by Example

Bloom Filters by Example A Bloom filter is a data structure designed to tell you, rapidly and memory-efficiently, whether an element is present in a set. The price paid for this efficiency is that a Bloom filter is a probabilistic data structure: it tells us that the element either definitely is not in the set or may be in the set. The base data structure of a Bloom filter is a Bit Vector. Here's a small one we'll use to demonstrate: Each empty cell in that table represents a bit, and the nu

Primitive Kolmogorov complexity is computable

/ 5 min read This post is mostly AI generated, of course with significant guidance, feedback, iteration and some edits from me. There was little for me to gain writing this myself, but I felt it needed to be written down regardless. Kolmogorov complexity and Solomonoff's theory of inductive inference offer formal, theoretical solutions to measuring complexity and forming predictions. However, both are uncomputable, a fact that is often treated as having significant implications in computabilit

Minimal Boolean Formulas (2011)

Minimal Boolean Formulas Posted on Wednesday, May 18, 2011. 28. That's the minimum number of AND or OR operators you need in order to write any Boolean function of five variables. Alex Healy and I computed that in April 2010. Until then, I believe no one had ever known that little fact. This post describes how we computed it and how we almost got scooped by Knuth's Volume 4A which considers the problem for AND, OR, and XOR. A Naive Brute Force Approach Any Boolean function of two variables ca

Minimal Boolean Formulas

Minimal Boolean Formulas Posted on Wednesday, May 18, 2011. 28. That's the minimum number of AND or OR operators you need in order to write any Boolean function of five variables. Alex Healy and I computed that in April 2010. Until then, I believe no one had ever known that little fact. This post describes how we computed it and how we almost got scooped by Knuth's Volume 4A which considers the problem for AND, OR, and XOR. A Naive Brute Force Approach Any Boolean function of two variables ca