17 lines
1.1 KiB
Markdown
17 lines
1.1 KiB
Markdown
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.
|
|
<!-- more -->
|
|
## 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 programatically generate web content.
|
|
|
|
## Modules
|
|
I leanned 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!" |