Live data from Hacker News

SICP in JavaScript

sourceacademy.org

121–126 of 126 posts

Re: SICP in JavaScript

#122

Earlier quoted context omitted.

Nothing but when you nest them a whole bunch they are far harder to read and understand that if/else.

(is(((it any) harder than) this?))

You'd be surprised at how readable Lisp is for people who actually learn it instead of just saying "look, weird language ha-ha!"

Re: SICP in JavaScript

#123
post #12

It seems like they have attempted to write scheme using JavaScript syntax to avoid having to make any significant changes to the non-code sections of the book. Here is an excerpt, it's not good: function deriv(exp, variable) { return is_number(exp) ? 0 : is_variable(exp) ? is_same_variable(exp, variable) ? 1 : 0 : is_sum(exp) ? make_sum(deriv(addend(exp), variable), deriv(augend(exp), variable)) : is_product(exp) ? m…

One thing I have learnt very well from rewriting a legacy PHP code written by amateur teams is: never ever nest ternary operations. maybe it's only me, but it's really hard to reason about this.

Haven't had the pleasure of dealing with this, but I'm told PHP has a uniquely broken idea of ternary: http://phpsadness.com/sad/30

Re: SICP in JavaScript

#124
post #47
post #43

I think SICP and Scheme go together like horse and carriage, and neither Python, JavaScript or other "real world" languages should taint the insight gained from that wonderful pairing. Because Scheme - being a LISP - has the same syntax for code and data, metalinguistic abstraction is facilitated. Nobody should have to read through boilerplate code to dig up the core message of SICP. I took the Algorithmics I course…

I think SICP would be just peachy in Elixir, but I’m coming around to the notion that keeping functional programming for functional programmers is a form of professional neglect. Functional core, imperative wrapper is one of the few sane ways to build a large (Conway’s Law afflicted) system, and too many of my peers never studies SICP in school. They don’t even know the damage they do, and as we’ve learned in many, m…

> JavaScript is only one corner of the programming world.

True, but it's a very obtuse corner!

Re: SICP in JavaScript

#125
post #82

Earlier quoted context omitted.

Scheme is not a functional programming language. The last 2/3rds of sicp are possible only because you can mutate state.

Scheme is not a pure functional language. I think you need to check the rest of your notes.

According to Let Over Lambda, Lisp is the least functional programming language ;)

https://letoverlambda.com/textmode.cl/guest/chap5.html

Re: SICP in JavaScript

#126
post #82

Earlier quoted context omitted.

Scheme is not a functional programming language. The last 2/3rds of sicp are possible only because you can mutate state.

Scheme is not a pure functional language. I think you need to check the rest of your notes.

    (define lol
      (let ((a 0))
        (lambda ()
          (set! a (+ a 1))
          a)))
Scheme is a functional programming language in the same way python is. The only difference is that it has tail call optimisation and the stack doesn't have an arbitrary limit on the number of function calls it can hold.
Post reply on HN