Live data from Hacker News

SICP in JavaScript

sourceacademy.org

111–120 of 126 posts

Re: SICP in JavaScript

#111

Earlier quoted context omitted.

Did you mean to say "SCIP SICP"? :-D

>Did you mean You sound like Google.

>You sound like Google.

not just by the literal text "Did you mean" that you used, but also due to being like Google in telling us what and how to think and read, or in (mis)interpreting the meaning of what we type.

You have a bright future.

Re: SICP in JavaScript

#112

Earlier quoted context omitted.

>Did you mean You sound like Google.

>You sound like Google. not just by the literal text "Did you mean" that you used, but also due to being like Google in telling us what and how to think and read, or in (mis)interpreting the meaning of what we type. You have a bright future.

You can edit your posts instead of replying to the same person multiple times and to yourself. Within the first 2 hours (hour and a half?) there is an "edit" option on your comment (this is also true for submission titles).

Re: SICP in JavaScript

#113
Heh, I took this class back in August 2018 where it originated, at the National University of Singapore (NUS), CS1101S[1] taught by Dr. Martin Henz.

I was someone who thought he knew all about computers because I could program a tiny bit of C++ and Java, and thought this class would be a piece of cake. I couldn't have been more mistaken. The class kicked my arse so badly. I remember my score for the midterm: 34/75. I ended up getting a B– for it. I'll be honest, I hated it at first. Where were the loops, where were the arrays? Why was everything involving recursion? Why did some recursive code give rise to iterative algorithms, and others, recursive ones (the difference is tail-call optimisation to give constant stack space versus some growing stack space)? Why were lists this weird nested square bracket syntax???

The irony is that in my fifth year last year, I ended up becoming a teaching assistant for the very same module itself, because I realised how useful the module would be. There was truly a little bit of everything: from algorithmic complexity, to data structures, to even a bit of compilers and garbage collection, with the environment model of execution, meta-circular evaluator at the end of the textbook, respectively.

I had to prove to the lecturer that despite my rather lousy grade in the module itself, my experience in everything else counted as something. A compilers class that was conducted entirely in OCaml was a great refresher on functional programming techniques, as was my internships where I learnt C#'s LINQ. I read the textbook end-to-end while preparing to teach the class—something I ought to have done as a student in the first place. My opinion of the class has changed drastically: it's one of the best introductory CS modules there is, and the fact that NUS chose to use SICP as a textbook is one reason why its CS department has skyrocketed.

I have no comment about emulating Scheme with JS. I neither like nor use either language.

[1]: https://nusmods.com/courses/CS1101S/programming-methodology

Re: SICP in JavaScript

#114

Heh, I took this class back in August 2018 where it originated, at the National University of Singapore (NUS), CS1101S[1] taught by Dr. Martin Henz. I was someone who thought he knew all about computers because I could program a tiny bit of C++ and Java, and thought this class would be a piece of cake. I couldn't have been more mistaken. The class kicked my arse so badly. I remember my score for the midterm: 34/75. I…

Great how you not only understood where you messed up, but that you used it to level up, master the material, and help others to master the material.

Re: SICP in JavaScript

#116

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…

It's not great and I'm not sure I'd play along but despite my own amazement, I've seen and been forced to do worse.

Re: SICP in JavaScript

#117

Earlier quoted context omitted.

>You sound like Google. not just by the literal text "Did you mean" that you used, but also due to being like Google in telling us what and how to think and read, or in (mis)interpreting the meaning of what we type. You have a bright future.

You can edit your posts instead of replying to the same person multiple times and to yourself. Within the first 2 hours (hour and a half?) there is an "edit" option on your comment (this is also true for submission titles).

I did know about the edit feature from before, and have used it sometimes in the past, but thank you for mentioning it.

In the above cases, I chose not to, for whatever reason (I'm not sure or don't remember why).

But your comment makes me think that I should have used it in some of the cases above.

Re: SICP in JavaScript

#118
post #82
post #47

Earlier quoted context omitted.

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…

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

#119
post #98

Earlier quoted context omitted.

Not sure what you mean, but ternaries are right-associative in Perl just like most other languages. PHP is the odd one out.

Except when they're not.

And when is that? The docs just say it's right associative[1]. And while it's been a long time since I've written any nontrivial Perl, I don't remember ever having ?: be left associative.

[1] https://perldoc.perl.org/perlop

Re: SICP in JavaScript

#120
post #93

Earlier quoted context omitted.

> So then astronomy is about telescopes...? No? I never said that. SICP teaches concepts, those concepts are better understood with lisp. Astronomy teaches concepts, those concepts are better understood with telescopes. In neither case is the subject about the tool, it's just better understood with the tool.

I just really think you should be ready to accept the full force of your words: >Same thing here -- SICP just isn't the same if it's not in scheme or lisp. That straight up reads like SICP and lisp are inseparable and that exactly means that SICP is not as general as people claim. What we have here is unstoppable force meets immovable object (otherwise known as a contradiction). The resolution is simple: either SICP…

> That straight up reads like SICP and lisp are inseparable and that exactly means that SICP is not as general as people claim.

They are separable, but there is a loss of elegance.

For example Scheme has linked lists and symbols built-in in an elegant way. The JavaScript version tries to provide them, but in a clunky way. Symbols are replaced by strings and the (a b c) notation of Scheme looks as ["a", ["b", ["c", null]]] or list("a" "b" "c") in the JavaScript version.

That a text may make use of the language it is written in, that should not be surprising. Thus the language shapes what and how it is said.

Post reply on HN