News for hackers. Stuff that matters.

danoman

Re:Ask HN: Can you recommend me a book to (re)learn math? on Monday December 05, 2022 @01:35PM (#33869717)
Start with linear algebra and (multivariable) calculus. Universities usually teach these in the beginning semesters. I would argue that linear algebra is the most important one (see also lecture from Princeton).

- Linear Algebra Full Course - Dr. Valerie Hower:

https://www.youtube.com/playlist?list=PLpcwHaLYiaEXW5fLNOlIt...

- Multivariable calculus, full semester - Diana Davis:

https://www.youtube.com/playlist?list=PL3e7J-yDTmahubJZoHodT...

- Linear Algebra (Princeton University)

https://www.youtube.com/playlist?list=PLGqzsq0erqU7w7ZrTZ-pW...

- immersive linear algebra

http://immersivemath.com/ila/index.html

- Linear Algebra Done Wrong by Sergei Treil

https://www.math.brown.edu/streil/papers/LADW/LADW.html

Axler's book on linear algebra seems to be well written and concise.

I have more, but, I am multilingual so, I guess they can't fit in here.

Re:Everything I wish I knew when learning C on Tuesday November 29, 2022 @03:28AM (#33785020)
Return pointer to array of 4 integers:

  int32_t (* bar(void))[4] {
      static int32_t u[4] = {1, 0, 1, 0};
      return &u;
  }
Return a pointer to a function taking a char:

  void f(char a) {
      // ...
  }

  void (* baz(void))(char) {
      return f;
  }
Re:Everything I wish I knew when learning C on Tuesday November 29, 2022 @03:02AM (#33784847)
Beware of struct padding.

sizeof(b.arr) != sizeof(b)

Consider:

  #include <stddef.h>

  #include <inttypes.h>

  typedef struct Array Array;

  struct Array {
      int32_t data[8];
  };

  void foo(Array const* arr) {
      size_t sz = sizeof(arr->data);
  }