That may be true, but it may also mean you utilize more memory than you need to. If you aren't shrinking the array when you no longer need previously allocated capacity then you're wasting memory. You could end up with…
I don't think it's that rare. I've been using the technique for years, and I've seen it done in other work. Bagwell's VList[1] for example uses the equivalent of `bit_ceil` to determine the size of each block without…
If you use a struct with a `void*`, you also need to specify the type on usage, where here it's done with `typeof`.
In C23 this approach is nice, but in older versions of C we end up with awful macros where we need to define the structure before we use it. #define Array(T) struct array_##T #define DEFINE_ARRAY(T) struct array_##T {…
The reason the struct is avoided here is so the array can be typed to its element type (rather than casting to and from `void*`). With a struct we would need one struct for each element type - at least prior to C23…
The concept of not storing capacity isn't silly. If you need to reserve space then it's not the appropriate structure, but it's otherwise fine. However, using an 2-element array to avoid using a struct is silly.
Really? It's been done plenty and I thought was quite common knowledge. Some of the <stdbit.h> provided functions are basically for this purpose. stdc_bit_ceil(len) gets the smallest power of 2 not less than len, which…
Bitcoin has a variable width encoding (`CompactSize`), but it doesn't prevent overlong encodings - however there are various canonicalization rules in the Bitcoin protocol to require minimal encoding.
The C charter has a rule of "no invention". Anything needs to be demonstrated and used in practice before being included in the standard. The standard is only meant to codify existing practices, not introduce new ideas.…
Lisps are expression based languages, but not pure. It's easy to mistake it as "like most other languages", but it's not quite the same - everything is an expression and returns a result. There are no "statements". They…
Operatives are based on FEXPRS from older lisps - they're basically a function-like form, but where the operands are not implicitly reduce at the time of call. (foo (+ 2 3) (* 3 4)) ($bar (+ 2 3) (* 3 4)) `foo` is a…
There's no "external representation" for environments. In klisp it will just print: [#environment] The environment type is encapsulated, so it doesn't give you very useful debug information. Perhaps having `@` produce…
I use klisp[1] and bronze-age-lisp[2] mostly for testing, as they're the closest to a feature complete implementation of the Kernel Report. I've written a number of less complete interpreters over the years. I currently…
I understand the use case, but Scheme macros never felt intuitive to me. I think it may be the quotation more than anything that I dislike - though I also dislike that they're second class (which was the key thing which…
Operatives do that for me, better than macros. Parent is correct that macros are compile time, which gives them a performance advantage over operatives - but IMO, they're not better ergonomically. I find operatives…
In Kernel I would use something like this: true #t false #f null () [...] (& ...) "k" : v (: k v) {...} (@ ...) Where &, :, @ are defined as: ($define! & ($lambda args (cons list args))) ($define! : ($vau (key value)…
When I learned Scheme, I liked the language but strongly disliked macros and quotation. I'd only been using it a short while and when I searched for solutions to a few problems these "fexpr" things kept appearing up,…
It's potentially useful for computer algebra with complex numbers - we might be able to simplify formulas using non-standard methods, but instead via pattern matching. We might use this to represent exact numbers…
The difference is that 90s games had novelty at the time - many introduced new gameplay ideas. A lot of today's AAA games have converged into a small number of genres like the open world action RPG games which all have…
The subway system in Kyoto (Karasuma line) is operated by the local government. I visited during the busiest time of the year (Gion matsuri), and the trains were not overcrowded, were frequent and arrived on the dot.…
If you intend to do a fair amount of travelling and your stay is <3 weeks, it may be worth getting a JR Pass[1]. It doesn't work for all lines, but does include the Shinkansen and several of the major inner-city lines.…
The silly thing is that your "blockchain" could be the smartest thing in the world, have super incredible cryptography or whatever. You can have the smartest developers in the world writing the software without bugs.…
Reminder that the computer's endianness shouldn't matter. You should only care about the endianness of the streams your reading from and writing to. https://commandcenter.blogspot.com/2012/04/byte-order-fallac...
It double types each letter I type. Quite annoying.
S-expressions are more like the tupled argument form, but better. (f x y z) Is equivalent to: (f . (x . (y . (z . ()))) Every function takes one argument - a list. Lists make partial application simpler than with tuples…
That may be true, but it may also mean you utilize more memory than you need to. If you aren't shrinking the array when you no longer need previously allocated capacity then you're wasting memory. You could end up with…
I don't think it's that rare. I've been using the technique for years, and I've seen it done in other work. Bagwell's VList[1] for example uses the equivalent of `bit_ceil` to determine the size of each block without…
If you use a struct with a `void*`, you also need to specify the type on usage, where here it's done with `typeof`.
In C23 this approach is nice, but in older versions of C we end up with awful macros where we need to define the structure before we use it. #define Array(T) struct array_##T #define DEFINE_ARRAY(T) struct array_##T {…
The reason the struct is avoided here is so the array can be typed to its element type (rather than casting to and from `void*`). With a struct we would need one struct for each element type - at least prior to C23…
The concept of not storing capacity isn't silly. If you need to reserve space then it's not the appropriate structure, but it's otherwise fine. However, using an 2-element array to avoid using a struct is silly.
Really? It's been done plenty and I thought was quite common knowledge. Some of the <stdbit.h> provided functions are basically for this purpose. stdc_bit_ceil(len) gets the smallest power of 2 not less than len, which…
Bitcoin has a variable width encoding (`CompactSize`), but it doesn't prevent overlong encodings - however there are various canonicalization rules in the Bitcoin protocol to require minimal encoding.
The C charter has a rule of "no invention". Anything needs to be demonstrated and used in practice before being included in the standard. The standard is only meant to codify existing practices, not introduce new ideas.…
Lisps are expression based languages, but not pure. It's easy to mistake it as "like most other languages", but it's not quite the same - everything is an expression and returns a result. There are no "statements". They…
Operatives are based on FEXPRS from older lisps - they're basically a function-like form, but where the operands are not implicitly reduce at the time of call. (foo (+ 2 3) (* 3 4)) ($bar (+ 2 3) (* 3 4)) `foo` is a…
There's no "external representation" for environments. In klisp it will just print: [#environment] The environment type is encapsulated, so it doesn't give you very useful debug information. Perhaps having `@` produce…
I use klisp[1] and bronze-age-lisp[2] mostly for testing, as they're the closest to a feature complete implementation of the Kernel Report. I've written a number of less complete interpreters over the years. I currently…
I understand the use case, but Scheme macros never felt intuitive to me. I think it may be the quotation more than anything that I dislike - though I also dislike that they're second class (which was the key thing which…
Operatives do that for me, better than macros. Parent is correct that macros are compile time, which gives them a performance advantage over operatives - but IMO, they're not better ergonomically. I find operatives…
In Kernel I would use something like this: true #t false #f null () [...] (& ...) "k" : v (: k v) {...} (@ ...) Where &, :, @ are defined as: ($define! & ($lambda args (cons list args))) ($define! : ($vau (key value)…
When I learned Scheme, I liked the language but strongly disliked macros and quotation. I'd only been using it a short while and when I searched for solutions to a few problems these "fexpr" things kept appearing up,…
It's potentially useful for computer algebra with complex numbers - we might be able to simplify formulas using non-standard methods, but instead via pattern matching. We might use this to represent exact numbers…
The difference is that 90s games had novelty at the time - many introduced new gameplay ideas. A lot of today's AAA games have converged into a small number of genres like the open world action RPG games which all have…
The subway system in Kyoto (Karasuma line) is operated by the local government. I visited during the busiest time of the year (Gion matsuri), and the trains were not overcrowded, were frequent and arrived on the dot.…
If you intend to do a fair amount of travelling and your stay is <3 weeks, it may be worth getting a JR Pass[1]. It doesn't work for all lines, but does include the Shinkansen and several of the major inner-city lines.…
The silly thing is that your "blockchain" could be the smartest thing in the world, have super incredible cryptography or whatever. You can have the smartest developers in the world writing the software without bugs.…
Reminder that the computer's endianness shouldn't matter. You should only care about the endianness of the streams your reading from and writing to. https://commandcenter.blogspot.com/2012/04/byte-order-fallac...
It double types each letter I type. Quite annoying.
S-expressions are more like the tupled argument form, but better. (f x y z) Is equivalent to: (f . (x . (y . (z . ()))) Every function takes one argument - a list. Lists make partial application simpler than with tuples…