Which language in DrScheme for SICP? - functional-programming

I have been using the Module for SICP in DrScheme 4.2 but which language has the best support for SICP in DrScheme?
Has anyone here tried this?
Thanks.

I don't think you need anything but R5RS which is available in DrScheme via Language > Choose Language....
You might want to allow redefinition of bindings. After you have selected R5RS, click on "Show Details" and uncheck "Disallow redefinition of initial bindings".
Some places in the text uses an error function, which is not available in R5RS. In these cases you can use srfi-23.
Another option is to simply use the "scheme" module language. Select "Module" as your language of choice and start your source files with #lang scheme or #lang scheme/base.
For the chapter "Example: A Picture Language" you can try this package (I have not tried it myself, so I don't know how well it works).

SICP Support for DrRacket
This package implements support in PLT’s DrRacket for Abelson and
Sussman’s Structure and Interpretation of Computer Programs (SICP) 2nd
Edition textbook, for students who wish to use DrRacket’s tools for
the SICP programming assignments.
http://www.neilvandyke.org/racket-sicp/

I am at the exact same place in SICP, and am using - 'Essentials of Programming Languages' as the language. It has not caused any problems yet.

Related

What is the best way to use Sage

I am using Sage (or SageMath) for doing some mathematics, and I would like to make it a habit of mine to use it and to teach it to students. However I have an organisational problem on how to use Sage!
As far as I know, there are these options to use Sage:
on a terminal
on a notebook
However, I would like to use it writing my code in separated script files well documented and running them on a terminal once it is done. Is there a way to do so?
Besides the SageMath tutorial which has a section on ways to use SageMath, some alternative lists have been provided as answers to some questions on Ask Sage, such as
Ask Sage question 42876: Other than Jupyter notebook is there any other way to use Sage
Ask Sage question 34350: Installing on Windows 10
Maybe you would be interested in the
Sage-shell-mode for Emacs
or maybe in running Sage in an IDE like PyCharm or Spyder, in which case see
Make PyCharm recognise the Sage python interpreter
Note also Tomer Bauer's 2019-06 "Introduction to Sage"
as a Jupyter slideshow available from the
Talks and presentations page on the Sage wiki
for another nice way to use Sage in a teaching context.

Can VS code change the color of extra "end"?

Atom has a setting/package that (while programming ruby) will change the text color of an "end" if it doesn't have a corresponding "def","do", or "if" block. (i.e purple "end" = good but white "end" = bad) Is this possible in VS code?
The feature you are looking for is known as balanced pair syntax highlighting.
Atom uses Tree-sitter for its syntax highlighting. Tree-sitter is a full parser using code in C++ which can most any programming language. The Ruby grammar is fairly big; I don't see the specialized block end formatting that you describe in a cursory glance, although I don't doubt that it's there somewhere.
Visual Studio Code uses its own complex language server system for syntax highlighting. The documentation for the Ruby language server claims that it indeed implements balanced pair highlighting, so if it's not working for you, I'd recommend filing a bug report.

Trouble of understanding the concept of packages in Common Lisp

A time ago I started learning Common Lisp, but now I have come to my first real stumbling block, understanding a concept. I started to change my learning projects to move from single file sources to packages. Everything so far went as expected, but then, I stumbled upon one file, a sudoku game I coded, that behaves other then I thought. You can find it here: https://github.com/Silberbogen/cl-sudoku
When I started (spiele-sudoku) after I switched inside the package via (in-package :cl-sudoku), everything works fine, but when I start it via (cl-sudoku:spiele-sudoku), only my input of coordinates is excepted, while any other input seems not to be interpreted.
What concept do I miss, so I could start the game via (cl-sudoku:spiele)?
You use read-from-string to read your input. That will intern any word encountered as a symbol into the current package.
In your main function, you use case to compare with symbols, but those are interned into the cl-sudoku package. So, if your current package is cl-sudoku, it will work, otherwise not.
You should not use read or read-form-string to parse user input (if you absolutely must, at least bind *read-eval* to nil). Instead call intern yourself (possibly in combination string-upcase) to create symbols in the right package. If you want to use package-independent symbols, intern them into the KEYWORD package, so that you can do case on keywords.
It might be helpful to use ecase or ccase, or at least log some debug information on invalid input.

Changing Cntrl + R shortcut for Running scripts in R Windows GUI

Is is possible to change the "Control + R" shortcut for sending scripts from the R text editor in the Windows GUI to the R console? I'd like to change it to "Control + Enter" to be more like the shortcut on my Mac. I do all my normal work on a Mac but have to use R on a PC to interface with some PC-only computational software.
Additional tidbits:
I'd rather not run an IDE on the PC if I don't have to, though perhaps this is the solution.
I use Rstudio on my Mac, but Rstudio does not get along with the PC software I'm running
The short answer is:
"No, there are no [built-in] ways to alter the menu shortcuts in the R Console"
I'm however gathering here -community wiki style- some of suggestions posted as remarks to this questions.
One approach may be to download the R source, hack it (see circa line 625 of src/gnuwin32/editor.c: ), and build the R binary anew (see the R for Windows FAQ for the tools you need to build from source). This seems to be a rather radical approach for the mere convenience of using an alternate keystroke sequence...
A similar approach may be to create an automatic patcher program which would patch the R executable, by locating the byte patterns surrounding the compiled logic of editor.c mentioned above and replacing it with a byte sequence for the desired keystroke. This solution may be sensitive to changes in the binaries, but also avoids the build process altogether...
An easier way to achieve this is probably by using an external text editor. Most modern editors have macros or configs that can be used, for example, to execute a source command in R for the selected text.
Customizing keyboard shortcuts is made available in Rstudio 0.99.644.
See https://support.rstudio.com/hc/en-us/articles/206382178-Customizing-Keyboard-Shortcuts for more information.

Adding Color Themes to Lispbox

I'm new to using Common Lisp and currently using Lispbox.
I would like to add a color-theme package to Lispbox running on OSX to change the color theme.
I'm currently trying to use the command:
(add-to-list 'load-path "~/desktop/colortheme/")
However I keep getting the same error:
Undefined function ADD-TO-LIST called with arguments (LOAD-PATH "/desktop/colortheme/").
Can someone please help me as to what to do from here?
Thanks in advance,
Cameron
As far as I know, Lispbox is simply a preconfigured bundle of Emacs, Slime, and Clozure CL. I think that you might be confusing the Emacs Lisp and the Common Lisp parts of that bundle. You need to put the snippet you showed into the Emacs Lisp part, i.e. (to get that configuration at startup) the .emacs configuration file. The REPL, that is, the CL-USER > prompt, is the Common Lisp interface and has nothing to do with Emacs' inner workings.

Resources