Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
kbp
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
40 ms
·
301.
▲
by
kbp
9y ago
Why is DEFUN-INLINE used over: (declaim (inline (setf vref))) (defun (setf vref) (new-value chip x y) (setf (aref (chip-video chip) (+ (* +screen-width+ y) x)) new-value))
302.
▲
by
kbp
9y ago
Is that news to anyone? Sussman and Steele showed that tail recursive functions are equivalent to for loops over 40 years ago. Map, reduce, et al can be built on top of either of them, and they're just as useful built on top of either.
303.
▲
by
kbp
9y ago
> The canned list processing functions can be implemented with a for loop. So? They abstract out common patterns. You could write the great majority of functions' implementations inline instead of calling them.
304.
▲
by
kbp
9y ago
It's certainly not bad grammar, but starting a lot of sentences with the word I is often considered bad style (both for the repetition and for the emphasis it places on yourself), and it's something a lot of kids do naturally; I a
305.
▲
by
kbp
9y ago
> In a functional language (like Scheme) strings are immutable, so they are fixed size. Strings are mutable in standard Scheme (unlike, say, Java): #;1> (let ((string (string-copy "foo"))) (string-set! strin
306.
▲
by
kbp
9y ago
Strings are usually represented as arrays (Haskell represents them as linked lists; it's the only exception I can think of offhand), which are a fixed length. To append to an array, you need to allocate a larger one and copy everything
307.
▲
by
kbp
9y ago
> The "Algebraic Manipulation of Symbolic Expressions" was basically predecessor to S-exps, but with commas. Early Lisp used commas as well. The Lisp I Programmer's Manual from 1960 has a note[0] when moving from a theoret
308.
▲
by
kbp
9y ago
> notion of a `calleable` type is gone You can do this using the metaobject protocol and defining a class with a metaclass of FUNCALLABLE-STANDARD-CLASS, for example, given: (defclass c () ((x :initarg :x :accessor x))
309.
▲
by
kbp
9y ago
Logo lets you leave out parentheses most of the time, except to use rest arguments or force grouping. For example: ? print list sum 0 1 2 1 2 That expression parses as (print (list (sum 0 1) 2)) because both list and sum normal
310.
▲
by
kbp
9y ago
I understand this point of view if most of your programs are just doing arithmetic, but once you start using functions and procedures the differences are pretty minimal.
311.
▲
by
kbp
9y ago
You would have a syntax error with a single PRINT form and no DO, too.
312.
▲
by
kbp
9y ago
> It's almost necessary for any dialect of LISP to support lambdas (i.e. functions) that contain a LISP 'do' [1] which lets you group statements. > [1] http://www.lispworks.com/documentation/lw60&#
313.
▲
by
kbp
9y ago
> Was I the only person who did not understand the draw of Logo as a kid? Having to use it in school made me feel like the world viewed me as a lobotomy victim. > And today, whenever one of these teaching-kids-to-program language/
314.
▲
by
kbp
9y ago
That doesn't explain why, because there's no implicit conversion to int when adding things, eg: >>> s = '12' >>> int(s) 12 >>> s + s '1212'
315.
▲
An Algebraic Language for the Manipulation of Symbolic Expressions (1958) [pdf]
(softwarepreservation.org)
171 points
by
kbp
9y ago
|
12 comments
316.
▲
by
kbp
9y ago
> >McCarthy's earlier work on Lisp wasn't Lisp. > I didn't say this. Again, I was asking how what you did say was different from it. Your answer seems to just be that your definition of Lisp means the subset describe
317.
▲
by
kbp
9y ago
> > so how would the purely functional subset described in a later paper be "the original LISP" if you aren't denying the earlier work? > Again the definition. I have already explained what I meant with "the ori
318.
▲
by
kbp
9y ago
> At least McCarthy had some pureness in his mind for LISP and it is not black or white argument. In his 1958 paper describing what would become Lisp, literally the first example of the use of car he gives is destructively modifying a co
319.
▲
by
kbp
9y ago
I think the argument comes because your initial statement was "The original LISP is pure functional," which isn't true. McCarthy's original idea of Lisp was not purely functional and the original Lisp implementation was
320.
▲
by
kbp
9y ago
But people using Python do at different times use destructuring, pop, and indexing to get values out of a list, which are the different ways of doing the same thing that you demonstrated. e: Just clarifying that your complaint here is that
321.
▲
by
kbp
9y ago
You aren't really showing off different ways to get arguments in any of those examples. In all of them, you get the arguments in a list called @_; you're just showing off three different ways to get values out of a list, which Pyt
322.
▲
by
kbp
9y ago
I found an even older reference to impure Lisp; doubt I'm going to do better than this: McCarthy's 1958 paper "An Algebraic Language for the Manipulation of Symbolic Expressions"[0], immediately after introducing our goo
323.
▲
by
kbp
9y ago
> Lets not kid ourselves, hiding lambda's is one of the primary uses of macros in Lisp (obviously not the only). Yes, you're hiding the "how", we don't disagree there, but my point was that such syntactic abstrac
324.
▲
by
kbp
9y ago
My point was that I have never seen any evidence that such an idea was ever called Lisp. Even the 1960 paper differentiates between the functional programming theory and the language Lisp being used to explore that theory. If we're bun
325.
▲
by
kbp
9y ago
But can you find anything to point to from that period that talks about an actual programming language called Lisp from that time that was purely functional? McCarthy's 1960 paper isn't about Lisp, it's about recursive functi
326.
▲
by
kbp
9y ago
> I think that the author needs to learn about association lists. The constructor (define point '((x 1) (y 2) (z 3))) is as clear as any other language. Granted, (assoc 'x point) is a bit more verbose than point.x, but you coul
327.
▲
by
kbp
9y ago
> The original paper of LISP by John McCarthy http://www-formal.stanford.edu/jmc/recursive.html > Or the more accessible explanation by Paul Graham http://www.paulgraham.com/rootsoflisp.html >
328.
▲
by
kbp
9y ago
> The original LISP is pure functional in the sense that you don't change state of an object. Are you sure about that? RPLACA, RPLACD, NCONC, etc are present in the Lisp 1 Programmer's Manual dated March 1st, 1960: http:/
329.
▲
by
kbp
9y ago
Armed Bear Common Lisp[0] runs on the JVM. 0: https://common-lisp.net/project/armedbear/
330.
▲
by
kbp
9y ago
Lisp isn't really a functional language, it just pioneered a lot of concepts in functional programming. It has almost no concept of immutability, imperative code is everywhere, and if you try to write in a pure functional style you
More ›