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?))
SICP in JavaScript
121–126 of 126 posts
Re: SICP in JavaScript
#122Earlier 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?))
Re: SICP in JavaScript
#123It 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.
Re: SICP in JavaScript
#124I 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…
True, but it's a very obtuse corner!
Re: SICP in JavaScript
#125Earlier 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.
Re: SICP in JavaScript
#126Earlier 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.