Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
kbp
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
39 ms
·
331.
▲
by
kbp
9y ago
> Each character of those variable names takes up RAM. Not to mention that at least on the C64, only the first two characters are significant anyway, ie, 'abba', 'ab', and 'abcd' all refer to the same variab
332.
▲
by
kbp
9y ago
http://www.eternal-september.org/ offers free accounts for text groups.
333.
▲
by
kbp
9y ago
Clojure isn't Lisp because it doesn't run Lisp programs and has different syntax and semantics to Lisp. McCarthy's original Lisp, Lisp 1.5, Maclisp, Emacs Lisp, Zetalisp, Common Lisp, EuLisp, etc, can share nontrivial program
334.
▲
by
kbp
9y ago
Older Lisps didn't tend to have strings as a separate datatype, they just used symbols and there was a function EXPLODE (and similar) for turning a symbol into a list of one-character symbols (or fixnums), and a corresponding IMPLODE (
335.
▲
by
kbp
9y ago
Not quite. In Lisp, when you get an error, the system pauses and lets you resolve the issue before resuming the program. Sometimes this even means typing in a function really quickly before a request times out (which isn't such an insa
336.
▲
by
kbp
9y ago
> If dealing with a function, the evaluation will always be arguments from left to right are evaluated first, and then the function is called with the result of evaluating the args. This is 95% of the cases. > If dealing with a macro,
337.
▲
by
kbp
9y ago
> What JS/Ruby/Lisp/Perl/Java do is irrelevant. Hey, C/Go/D/C++ would all be more likely to append by value, but neither of us care a whit because it's asking about Python, which I know nothing abo
338.
▲
by
kbp
9y ago
> The very fact that you must write (function sin), or #'sin, or use funcall is a way that it treats functions differently than normal values. It doesn't treat functions differently from other values. You can say (defvar fn (
339.
▲
by
kbp
9y ago
Pretty-printers are also useful for the times when Lisp is printing code for you to read, for example macro expansions.
340.
▲
by
kbp
9y ago
Common Lisp does have syntax for vectors, they're written #(1 2 3). It doesn't have literal syntax for hash tables, but it's a trivial read-macro if you can't live without it (although alists have some other nice propert
341.
▲
by
kbp
9y ago
> I wonder, does #(* %1) do anything sensible? It's a 1-argument function, so applying it to 2 arguments would give an error. Minus the arity error, 1-argument * is an identity.
342.
▲
by
kbp
9y ago
There's nothing preventing you from manually doing that when you type the code, but editors and pretty-printers won't know about it. Special-casing them to have "if the car of a list is cond, or this vector was preceded by le
343.
▲
by
kbp
9y ago
I agree, the decrease in editor-friendliness is really frustrating, coming from Lisp. The lack of parens around cond clauses is also annoying to me, because it makes it so that you can't really insert a newline after a predicate for le
344.
▲
by
kbp
9y ago
> Does matrix.append(x) in python append by reference or by value? Both are equally likely without knowing anything about the language. I don't think they're equally likely. The question would have the same answer in Javascript
345.
▲
by
kbp
9y ago
"is" is for asking whether two objects are the same exact object in memory. "==" is for asking whether two objects are logically equal, ie, that they represent the same value. As an example: >>> x = [1,2,3
346.
▲
by
kbp
9y ago
If you press ^C, it tells you how to quit. As to why it doesn't just exit, a lot of beginners would probably expect ^C in a text editor to copy text.
347.
▲
by
kbp
10y ago
> What do you suggest for CDAR then? Or CAAR? A user-defined function with a name indicating what you're reaching for. Occasionally you might want to write a generic cons handling function where all you can say is that it's the
348.
▲
by
kbp
10y ago
Lisp's support for numbers goes beyond automatic bignum promotion, for example (/ 1 3) gives the rational 1/3 instead of an approximation, and (sqrt -1) gives #C(0.0 1.0), that is, 0 + 1i.
349.
▲
by
kbp
10y ago
Those aren't particular to dynamic languages, though. You can add C, C++, Java, and C# to your list of languages that support it. Being able to explicitly make a parameter optional, or to have a 0-or-more rest argument is different fro
350.
▲
by
kbp
10y ago
> I use Form Feed (CTRL+L) character in my code to divide sections, and have configured Emacs to display them as a buffer-wide horizontal line. I've seen formfeeds used in source files like that before; it's a simple way of get
351.
▲
by
kbp
10y ago
> OS X will work on any hardware it is permitted to operate on. OS X is only "permitted to operate" on computers designed for it, though. Linux doesn't have issues running on models where the manufacturer actually supports
352.
▲
by
kbp
10y ago
That's my point--you're restarting the 'computation' instead of resuming it, compared to restarting the program. It's the same benefits you acknowledge, just, moreso.
353.
▲
by
kbp
10y ago
Until you get an error at the REPL.
354.
▲
by
kbp
10y ago
That difference does feel primitive, though; it's like a C-style edit->compile->run cycle vs talking to a listener. Like you said, tradeoffs, and Clojure definitely has a lot of other stuff going for it, but its version of intera
355.
▲
by
kbp
10y ago
It's especially disappointing coming from Common Lisp and expecting a debugger with restarts etc on error. Just getting a stack trace feels so primitive.
356.
▲
by
kbp
10y ago
It forces you to explicitly say that you know you're forcing a value into a narrower type; I think the fact that might mean loss of information is understood, by definition. What would you like it to do?
357.
▲
by
kbp
10y ago
Could you clarify what you mean? What's wrong with -DsomeParameter="$var"? Or am I misunderstanding?
358.
▲
by
kbp
10y ago
You can make it even easier on human readers by defining accessors (even if they're just wrappers over car/cdr) and giving them meaningful names. Asking for the car of the car of the cdr of the car of an ad-hoc data structure is p
359.
▲
by
kbp
10y ago
Conses are arbitrary pairs, not necessarily lists. car and cdr are what eg OCaml and Haskell call fst and snd.
360.
▲
by
kbp
10y ago
Yes, C is definitely a low-level language, I was just responding to someone's inaccurate justification for why you can't copy arrays like that.
More ›