CS2613/journal/_src/posts/2022-09-21-lab-04.md
2022-10-17 10:38:02 -03:00

1.1 KiB

Title: Lab Four
Date: 2022-09-21T08:30:00
Tags: cs2163, lab, racket, scribble

In this lab I learned about using functions as values, recursion, scribble, and modules in Racket.

Functions as values

You can pass functions as values into other functions which can then be used inside another function, or pass values into said function. This makes it easy to use a function a lot, or build a list of a function for example, with increasing values as its arguments.

Recursion

In racket I implemented a factorial function with recursion, and then tested the function to assure that the function is performing correctly.

Scribble Demo

I learned how you can use Scribble to use racket in a web page, to programmatically generate web content.

Modules

I learned about how to make modules, submodules, testing modules, and a main module. This was shown in a simple program that defined and exported one function called hello which simply printed "Hello!" I then used it in another application by using the require keyword. I then defined a main module that says when a the hello module is loaded it should print "Hello!"