Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
patrec
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
52 ms
·
451.
▲
by
patrec
6y ago
I have no problem switching between 1 and 0 based languages and have used both productively; as I said both have their pros and cons. If lua were mostly some standalone language, or even a glue language to the extend python is, there would
452.
▲
by
patrec
6y ago
Vanilla lua does a logarithmic search (still much better than a linear scan you'd get with ipairs), but I don't think that's typically true in luajit, although I admit I might be quite wrong about this. Here is some relevan
453.
▲
by
patrec
6y ago
> The thing that people who don't really know Lua don't get is that Lua doesn't give a shit whether you start at 1 or at 0. I don't really understand why this claim comes up all every time in these discussions, it
454.
▲
by
patrec
6y ago
There are pros and cons to both zero and one based indexing, but in the context of Lua going with 1-based indexing was IMO a complete disaster, and one of maybe two or three significant defects that has relegated an otherwise quite elegant
455.
▲
by
patrec
6y ago
You could just write this as (a is None) is not (b is None) or (a is None) != (b is None) It won't make a difference (and is 1 to to 5 characters longer), but it seems "cleaner" since it's more specific
456.
▲
by
patrec
6y ago
You are aware that ^ on a 1 bit value (like a boolean) is just !=, right?
457.
▲
by
patrec
6y ago
> Though it's cliché and often listed as a negative, emacs really gives the user more than just a program to edit text. I would not recommend emacs as an editor these days to most developers, but it absolutely still remains one of t
458.
▲
by
patrec
6y ago
That's not the point. Risc-V machines are not yet price competitive, but presumably will be at some point. This is for people who are interested enough in Risc-V to spend some time and a ~$100 on it, but not thousands of of dollars. An
459.
▲
by
patrec
6y ago
There is an annoying error: % is not 'modulo', it's the (less useful) remainder operator. julia> -1%9 -1 julia> mod(-1, 9) 8 python >>> -1%9 8
460.
▲
by
patrec
6y ago
Not true, with two random access iterators in C++ for example you can compute the distance between them, and thus the the length of an array (e.g. a.end() - a.begin()) and it will be constant time.
461.
▲
by
patrec
6y ago
Just to illustrate, some pretend-analogous run time type-inspect based dispatch code in python (a language not known for its blazing speed) is still much, much faster than this: In [3]: timeit a = [1]; a.__len__() if type(a) is list e
462.
▲
by
patrec
6y ago
> In short: it's slow because there isn't just one kind of Java array, and if you don't say which one you mean, Clojure has to do reflection to figure it out. But it can't need any less reflection than "count&quo
463.
▲
by
patrec
6y ago
Well, it's generic in the type of the array element, but it's not generic in that it only works with Java arrays not arbitrary sequences. In particular it's clearly less generic than count (in clojure) or len (in python). And
464.
▲
by
patrec
6y ago
This reads a bit like "why you shouldn't use clojure" to me. I'd expect to leave some performance on the table when writing idiomatic code in a dynamic language with immutable datatypes, but a function that's alread
465.
▲
by
patrec
6y ago
> One other nicety I'd add that you don't get from the Python stacktrace is the ability to inspect each frame to see the local bindings No, you do get that. Even in the plain python interpreter you can do import pdb; pdb.pm() a
466.
▲
by
patrec
6y ago
> I'm not proposing that we should optimise for life years saved, but I do think that the death of a 86 year old is less tragic than that of a 38 year old, and that we perhaps shouldn't evaluate lockdown vs no lockdown purely b
467.
▲
by
patrec
6y ago
> Stack traces are not standardized in Common Lisp, so this is a non-sensical statement. Yes, someone could have secretly implemented a common lisp implementation that has the most ergonomic stacktraces in the whole wide world or, equall
468.
▲
by
patrec
6y ago
Ugh o/c sorry, my bad, I should just have done it in slime to start with (esp since I've compared it ipython); was just too lazy: The value NIL is not of type (OR (VECTOR CHARACTER) (VECTOR NIL) BASE-STRING P
469.
▲
by
patrec
6y ago
I did. There just isn't much of a callstack, because I call a single function with an invalid argument.
470.
▲
by
patrec
6y ago
A good example would take a fair amount of space, but let's try this bogus example: This is ipython: In [2]: os.path.join(None) --------------------------------------------------------------------------- TypeError
471.
▲
by
patrec
6y ago
> Not the point I was making. I do not know which option will lead to less death, neither do you, What point were you making then? And yes, I think I do know which option will lead to less death, because I actually took the time to do so
472.
▲
by
patrec
6y ago
Exactly. For exploratory programming with long running computations losing all your state because of something you could fix by hot-reloading a one line change can be rather frustrating -- I remember cursing at python years ago when I was r
473.
▲
by
patrec
6y ago
> That said, it would mean the lowest amount of economic stress (which kills silently) for the following years What makes you think so? Did you look at the life-expectancy impact of severe economic downturns and compare them to likely ex
474.
▲
by
patrec
6y ago
There are already multiple working vaccines. Why on earth would you even contemplate killing or permanently damaging over a million people, just in the UK alone? Do you really think that 90% of the remaining population will be cool with tha
475.
▲
by
patrec
6y ago
Speaking only for myself, I think your opinion is idiotic based on some simple back of the envelope math I did many months ago (when the UK announced its herd immunity plan), relating to hospital capacity, likely peak case numbers, proporti
476.
▲
by
patrec
6y ago
> How do you guys think about the opportunity cost of learning dead/dying/new/unpopular languages? Interesting question. My advice would be as follows: 1. Learn one practical language really well, well enough that you ca
477.
▲
by
patrec
6y ago
Who in his right mind would use an editor that cannot even do symbolic integration? Joking aside, I suspect that this is mostly due to two factors: 1. Emacs was used by a lot of smart people, and one of them, David Gillespie got carried awa
478.
▲
by
patrec
6y ago
> One answer to all these propositions is that the valuable stuff is still there I don't understand the popularity of this argument. Whilst someone might (theoretically) have written the Great American Novel in his or her basement u
479.
▲
by
patrec
6y ago
The first part of your answer that sounds intuitively believable, namely that a bunch of chores accumulate by the end of a production cycle and that productivity is not as badly hit, so it might be possible to get more out of people by ov
480.
▲
by
patrec
6y ago
> To play devil’s advocate: addiction fills a void in an unfulfilling life. Maybe so, but one would hope that even as far as self-destructive vices are concerned it's possible to pick something with more upside than Farmville addict
More ›