CS2613/journal/_src/posts/2022-09-21-lab-04.md

17 lines
1.1 KiB
Markdown
Raw Normal View History

2022-09-22 16:16:55 -03:00
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
2022-09-27 18:11:08 -03:00
I learned how you can use Scribble to use racket in a web page, to programmatically generate web content.
2022-09-22 16:16:55 -03:00
## Modules
2022-09-27 18:11:08 -03:00
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!"