vault backup: 2025-02-24 20:55:43
This commit is contained in:
parent
57eaa378c6
commit
f8134b65ff
@ -17,4 +17,5 @@ sort by urgency
|
||||
group by tags
|
||||
```
|
||||
|
||||
# Calendar Tasks
|
||||
# Calendar Tasks
|
||||
- Z Planning [startTime:: 21:00] [endTime:: 22:00]
|
||||
@ -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.
|
||||
|
||||
@ -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]
|
||||
|
||||
@ -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
|
||||
---
|
||||
|
||||
@ -1,8 +0,0 @@
|
||||
---
|
||||
title: Rust Chapter 2
|
||||
allDay: false
|
||||
startTime: 20:30
|
||||
endTime: 21:00
|
||||
date: 2025-02-24
|
||||
completed: null
|
||||
---
|
||||
9
900s Calendars/Research/2025-02-25 Rust Chapter 2.md
Normal file
9
900s Calendars/Research/2025-02-25 Rust Chapter 2.md
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
title: Rust Chapter 2
|
||||
allDay: false
|
||||
startTime: 10:30
|
||||
endTime: 11:00
|
||||
date: 2025-02-25
|
||||
completed: null
|
||||
type: single
|
||||
---
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user