14- Combining Predicates
Jul 01, 2026 03:47
· 2:10
· English
· Whisper Turbo
· 2 Luidsprekere
Hierdie transkripsie verstrek vandag.
Gradeer op vir permanente berging →
Vertoon slegs
0:03
S…
Speaker 1 (14- Combining Predicates)
So we talked about composing functions to build more complex and interesting
0:08
S…
Speaker 1 (14- Combining Predicates)
functions We can also combine predicates to build more complex
0:12
S…
Speaker 1 (14- Combining Predicates)
predicates.
0:12
S…
Speaker 1 (14- Combining Predicates)
Let me show you so I'm going to declare two predicates a
0:16
S…
Speaker 1 (14- Combining Predicates)
predicate of a string called has left brace so
0:21
S…
Speaker 1 (14- Combining Predicates)
str goes to str
0:25
S…
Speaker 1 (14- Combining Predicates)
that starts with a left brace That's a
0:30
S…
Speaker 1 (14- Combining Predicates)
small reusable predicate
0:33
S…
Speaker 1 (14- Combining Predicates)
call the second predicate has right brace and
0:37
S…
Speaker 1 (14- Combining Predicates)
here we call the ends with method and pass
0:41
S…
Speaker 1 (14- Combining Predicates)
a right brace Now we can combine this predicates.
0:45
S…
Speaker 1 (14- Combining Predicates)
Let me show you.
0:45
S…
Speaker 1 (14- Combining Predicates)
So if you type has left brace dot look we
0:49
S…
Speaker 1 (14- Combining Predicates)
have and negate and or these are
0:53
S…
Speaker 1 (14- Combining Predicates)
equivalent to The logical and the logical or and
0:58
S…
Speaker 1 (14- Combining Predicates)
the not operator in Java.
0:59
S…
Speaker 1 (14- Combining Predicates)
So let's say has left brace
1:04
S…
Speaker 1 (14- Combining Predicates)
And here we should pass a second predicate.
1:07
S…
Speaker 1 (14- Combining Predicates)
So we pass has right brace.
1:10
S…
Speaker 1 (14- Combining Predicates)
Now this returns a new predicate.
1:12
S…
Speaker 1 (14- Combining Predicates)
We can store it over here and call it has
1:17
S…
Speaker 1 (14- Combining Predicates)
left and right braces.
1:18
S…
Speaker 1 (14- Combining Predicates)
And then just like any
1:22
S…
Speaker 1 (14- Combining Predicates)
other predicates,
1:23
S…
Speaker 1 (14- Combining Predicates)
we can use that to test an object.
1:27
S…
Speaker 1 (14- Combining Predicates)
So we call a test method and pass a string like this.
1:31
S…
Speaker 1 (14- Combining Predicates)
Key colon value.
1:33
S…
Speaker 1 (14- Combining Predicates)
this returns the result.
1:35
S…
Speaker 1 (14- Combining Predicates)
In this case the result is true because this string has both the left
1:39
S…
Speaker 1 (14- Combining Predicates)
and right braces.
1:40
S…
Speaker 1 (14- Combining Predicates)
Now we can also combine two predicates using a
1:44
S…
Speaker 1 (14- Combining Predicates)
logical OR.
1:44
S…
Speaker 1 (14- Combining Predicates)
So in this case we get a new predicate and this
1:48
S…
Speaker 1 (14- Combining Predicates)
returns true if our input string has either the left or the right brace.
1:53
S…
Speaker 2 (14- Combining Predicates)
Now,
1:54
S…
Speaker 1 (14- Combining Predicates)
what about the negate method?
1:56
S…
Speaker 1 (14- Combining Predicates)
That is pretty straightforward.
1:57
S…
Speaker 1 (14- Combining Predicates)
So we call the negate method and this returns a new predicate
2:02
S…
Speaker 1 (14- Combining Predicates)
that does the opposite of
2:04
S…
Speaker 1 (14- Combining Predicates)
the first predicate.
2:05
S…
Speaker 1 (14- Combining Predicates)
So this is how we can combine predicates.
Hierdie transkripsie is deur K- enkrities spraakerkenning voortgebring. Kan foute bevat takies wat teen die oorspronklike oudio vir kritiese gebruik bevestig is. Kunsmatige inteligensie beleid
Opsomming
Kliek opsomming na genereer 'n kunsmatige opsomming van hierdie transkripsie.
Ter opsomming...
Vra Kunsmatige inteligensie oor hierdie teks
Vra enigiets oor hierdie transkripsie 0°) die kunsmatige dele en antwoord.