Add lab 4 content.

This commit is contained in:
Isaac Shoebottom
2022-09-22 16:16:55 -03:00
parent baf9b933de
commit 3bb4db362e
8 changed files with 100 additions and 2 deletions

View File

@ -0,0 +1,17 @@
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!"

View File

@ -0,0 +1,14 @@
#lang scribble/manual
Title: Lab Three Scribble Demo
Date: 2022-09-21T09:00:00
Tags: cs2613, lab, racket, scribble
Demo of how Scribble works
<!-- more -->
@(define (hello) "hello")
@(define (todo hdr . lst) (list (bold hdr) (apply itemlist (map item lst))))
@hello{}
@todo["Shopping" "cheese" "fish" "shuriken"]