diff --git a/1 Daily Notes/2025/2025-02-24.md b/1 Daily Notes/2025/2025-02-24.md index 8818e4bba..0c30a6058 100644 --- a/1 Daily Notes/2025/2025-02-24.md +++ b/1 Daily Notes/2025/2025-02-24.md @@ -17,4 +17,5 @@ sort by urgency group by tags ``` -# Calendar Tasks \ No newline at end of file +# Calendar Tasks +- Z Planning [startTime:: 21:00] [endTime:: 22:00] \ No newline at end of file diff --git a/3-99 Research/Haskell/Chapter 2 - Starting Out.md b/3-99 Research/Haskell/Chapter 2 - Starting Out.md index 249b92116..a3434c0b1 100644 --- a/3-99 Research/Haskell/Chapter 2 - Starting Out.md +++ b/3-99 Research/Haskell/Chapter 2 - Starting Out.md @@ -144,3 +144,21 @@ Tuples are somewhat confused with lists, but they are not exactly the same. Tuples are useful in specific cases. Namely, when an explicit number of elements and their types are known. Tuples are designated by parentheses '()' +Also interestingly, tuples can have a mish mash of types inside them. The specific combination of types inside a tuple makes the tuple itself a certain type: + +```haskell +[(1,2), (3,4), (5,6)] -- is okay! +[(1,2), (8,5,11), (5,6)] -- is NOT okay! +[(1,2), ('Okay?', 2)] -- is NOT okay! +``` + +Tuples have special names for their sizes: +(1,2) - Pair +(3,4,5) - Triple +(4,5,6,7) - 4-tuple +(2,3,..,n) - n-tuple + +Here's some useful tuple functions: +fst: takes a pair and returns first component +snd: Suprise! gives the second component of a pair +zip: Takes two lists and makes pairs of the elements. Stops at the shorter list's end. diff --git a/3-99 Research/Haskell/baby.hs b/3-99 Research/Haskell/baby.hs index 548bcc1d9..77e9db15c 100644 --- a/3-99 Research/Haskell/baby.hs +++ b/3-99 Research/Haskell/baby.hs @@ -21,3 +21,12 @@ length' xs = sum [1 | _ <- xs] --- Strings are lists! We can use list comprehensions on them. removeNonUppercase st = [ c | c <- st, c `elem` ['A'..'Z']] +--------------Pythogoraus Problem---------------------- +--triangles with integer sides +triangles x = [(a,b,c) | c <- [1..10], b <- [1..10], a <- [1..10]] + +--right triangles +rightTriangles x = [(a,b,c) | c <- [1..10], b <- [1..10], a <- [1..10], a^2 + b^2 == c^2] + +-- Now only triangles with perimiter equal to 24 +rightTriangles' x = [(a,b,c) | c <- [1..10], b <- [1..10], a <- [1..10], a^2 + b^2 == c^2, a+b+c == 24] diff --git a/900s Calendars/Research/2025-02-24 Haskell Chapter 2.md b/900s Calendars/Research/2025-02-24 Haskell Chapter 2.md index ef097d789..8f8ebec04 100644 --- a/900s Calendars/Research/2025-02-24 Haskell Chapter 2.md +++ b/900s Calendars/Research/2025-02-24 Haskell Chapter 2.md @@ -2,7 +2,8 @@ title: Haskell Chapter 2 allDay: false startTime: 20:00 -endTime: 20:30 +endTime: 21:00 date: 2025-02-24 completed: null +type: single --- diff --git a/900s Calendars/Research/2025-02-24 Rust Chapter 2.md b/900s Calendars/Research/2025-02-24 Rust Chapter 2.md deleted file mode 100644 index f6c3a07c3..000000000 --- a/900s Calendars/Research/2025-02-24 Rust Chapter 2.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: Rust Chapter 2 -allDay: false -startTime: 20:30 -endTime: 21:00 -date: 2025-02-24 -completed: null ---- diff --git a/900s Calendars/Research/2025-02-25 Rust Chapter 2.md b/900s Calendars/Research/2025-02-25 Rust Chapter 2.md new file mode 100644 index 000000000..1eb4ccbb3 --- /dev/null +++ b/900s Calendars/Research/2025-02-25 Rust Chapter 2.md @@ -0,0 +1,9 @@ +--- +title: Rust Chapter 2 +allDay: false +startTime: 10:30 +endTime: 11:00 +date: 2025-02-25 +completed: null +type: single +--- diff --git a/900s Calendars/Research/Research - README.md b/900s Calendars/Research/Research - README.md index d66a958e9..7719b4437 100644 --- a/900s Calendars/Research/Research - README.md +++ b/900s Calendars/Research/Research - README.md @@ -6,7 +6,7 @@ - [[2024-09-10 Nuclear Engineering Steering Committee - Conf Room A UClub.md]] - [[2025-02-24 Haskell Chapter 2.md]] - [[2025-02-24 LEAN.md]] -- [[2025-02-24 Rust Chapter 2.md]] +- [[2025-02-25 Rust Chapter 2]] - [[2025-02-24 TLA Learning Plan and Notes.md]] ## Summary