Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
kbp
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
14 ms
·
91.
▲
by
kbp
8y ago
It seems weird to say "And because (as we learned earlier) we read word by word, too much spacing between words breaks this rhythm" as a reason to avoid justified text, and then immediately after say that you can temper bad justif
92.
▲
by
kbp
8y ago
> (It also looks like this was written on one of those ancient systems that didn't support lowercase and only allowed 6-character filenames) A limitation that also led to 'Schemer' dropping the R.
93.
▲
by
kbp
8y ago
> Nonsense, the enterprise programmer of the time was programming in C or C++ and was making heavy use of macros. C macros are entirely different in use from Lisp macros. C macros are written in a text substitution language that knows vi
94.
▲
by
kbp
8y ago
> What?? In chapter 4, you write your own Lisp interpreter. If they had chosen C++, would you be writing a C++ compiler? Or a Lisp interpreter in C++? That's in chapter 5 :) Exercise 5.51. Develop a rudimentary implementation of Sc
95.
▲
by
kbp
8y ago
SICP only uses a small subset of Scheme, and it's only using it as a minimal vehicle for exploring computer science. You can absolutely learn the amount of Scheme used in the book as you go (that's why they chose that subset: it&#
96.
▲
Top 10 Mistakes in Web Design (1996)
(nngroup.com)
4 points
by
kbp
8y ago
|
1 comments
97.
▲
by
kbp
8y ago
> I found python and ruby much easier to read and pick up. One reason for this is, that programmers are not allowed to define new irregularities. The mechanisms they give you are more than enough, though. Ruby especially favours this kin
98.
▲
by
kbp
8y ago
> I can be 100% sure that: `self` is an object with an attribute rfile, `=` is the assignment operator, there is a method `readline` that get's called with an integer argument 65537. I think this is overstating things, eg, the class
99.
▲
by
kbp
8y ago
There's a lot of approaches that might work; using something other than a list for your collection is just one (although it is often appropriate). If you just want option types that you can use with lists, the most direct way to do tha
100.
▲
by
kbp
8y ago
Oh, or more directly: [f(a, b) for a, b in it.permutations(some_list, r=2)] And then you could also use itertools.starmap instead of using a comprehension at all, if you wanted.
101.
▲
by
kbp
8y ago
itertools has functions that make that sort of nesting unnecessary (and some would say make the code clearer), eg: import itertools as it [f(a, b) for a, b in it.product(some_list, some_list) if a is not b]
102.
▲
by
kbp
8y ago
Do you have an example of where this would be a problem for you? What can't you represent?
103.
▲
by
kbp
8y ago
I remember finding it pretty revelatory the first time I saw LET defined as a macro like (defmacro let (bindings &body body) `((lambda ,(mapcar #'first bindings) ,@body) ,@(mapcar #'second bindings))) Se
104.
▲
by
kbp
8y ago
I guess it's useful for deriving a baseline level of confidence, like a low coverage score is a red flag, and an increasing coverage score probably corresponds to increasing test coverage, but my issue is that 100% coverage doesn'
105.
▲
by
kbp
8y ago
It used to, though. From the original Scheme paper: Note that in SCHEME, unlike MacLISP, the body of a LAMBDA expression is not an implicit PROGN.
106.
▲
by
kbp
8y ago
It's not about gaming the metric, it's just that the metric doesn't mean very much in the first place. Running a coverage tool during tests won't show you edge cases you forgot to handle in the code under test, it will s
107.
▲
by
kbp
8y ago
I can see what you're saying, but I think that argument would be a lot stronger if == compiled to ===. If you want an operator with ==='s semantics, it's there; providing == and claiming it behaves like === just seems like an
108.
▲
by
kbp
8y ago
I prefer it when Typescript tries to provide static type checking for Javascript rather than providing checking for how they wish Javascript was. `(x: number, y: string) => x == y` is an error because 'this condition will always ret
109.
▲
by
kbp
8y ago
> I think you're right that if FP is a trap at one end of the fallacy, pure OOP exists at the other. I disagree; what spectrum are those on opposite ends of? Encapsulation, polymorphism, and inheritance are entirely compatible with
110.
▲
by
kbp
8y ago
Syntactically, those are things that could have been implemented as operators, but aren't, they're just LOOP keywords; lots of functions take keyword arguments (edit: even if LOOP's are a little different from &key parame
111.
▲
by
kbp
8y ago
> I can't imagine that most folks are surprised by the general shape of most defun statements. The general shape of a LOOP expression is just a list of symbols and lists. A complicated LOOP expression that uses many features at on
112.
▲
by
kbp
8y ago
> My point was more on the rarity of "syntax breaking" macros. Why don't you consider macros like DEFUN, DEFCLASS, COND, etc to be "syntax breaking"?
113.
▲
by
kbp
8y ago
That's some Lisp code; if you enter it at a REPL, it prints the result of evaluating it: CL-USER> (defun add (a b) (+ a b)) ADD
114.
▲
by
kbp
8y ago
Sure, there's other ways to write it, the point of the post was Lisp's syntax, not the algorithm I used to demonstrate some features of it. You could write examples like yours in Lisp or Python, too. As well, your examples both sl
115.
▲
by
kbp
8y ago
> LISP doesn't really have syntax - you write parse trees directly. Lisp has plenty of syntax, it's just extensible and largely defined in operators. Commonly used macros like DEFUN, WITH-OPEN-FILE, and LOOP all add their own s
116.
▲
by
kbp
8y ago
> C has all these different kinds of control flow and all these built-in operators, whereas everything you would want to do in OCaml is just plain old functions and expressions. OCaml does have for and while loops, to be fair, although t
117.
▲
by
kbp
8y ago
I'd say that depends a lot on who you're talking to. I would answer like that to a close friend, but for most people I know I'd never answer more negatively than something like "eh, kinda stressed, but it's ok"
118.
▲
by
kbp
8y ago
Right, that's what I was explaining. A lot of people get tripped up by this because arr is equivalent to &arr, int arr[] is equivalent to int *arr as a formal parameter, etc, so many people go around with the idea that arrays are j
119.
▲
by
kbp
8y ago
> I always thought [] was just syntactic sugar over a regular pointer, but seems like I was wrong. For another example showing their differences, if a.c has: int n[] = { 1 }; And b.c has: extern int *n; printf("%d
120.
▲
by
kbp
8y ago
> The Straight Dope from Cecil Adams is like lots of that neat content that was essentially the internet before the internet. You start with this, and then go into more examples of "content that was essentially the internet before t
More ›