List deletion and selection, list deletion and selection
The clean function is used to delete list elements that meet the conditions. The filter function is used to select list elements that meet the conditions.
(clean symbol? '(1 2 d 4 f g 5 h)) → (1 2 4 5)(filter symbol? '(1 2 d 4 f g 5 h)) → (d f g h)(define (big? x) (> x 5)) → (lambda (x) (> x 5))(clean big? '(1 10 3 6 4 5 11)) → (1 3 4 5)(clean <= '(3 4 -6 0 2 -3 0)) → (3 4 2)(clean (curry match '(a *)) '((a 10) (b 5) (a 3) (c 8) (a 9)))→ ((b 5) (c 8))
In combination with lambda and member functions, clean can first set a list that contains all the elements to be removed, and then operate on another list. As long as the elements in the list appear in the first list, will be removed.
The following a is a string, first converted to list, then removed extra spaces with unique, leaving only one space, and finally removed the last space with clean + lambda + member. In this way, the string is changed to list.
> a"1 2 3 4"> (explode a)("1" " " "2" " " "3" " " "4")> (unique (explode a))("1" " " "2" "3" "4")> (clean (fn (p) (member p '(" "))) (unique (explode a)))("1" "2" "3" "4")
For example, the following code can be used to delete the files in the directory... and:
(clean (fn (p) (member p '("." ".."))) (directory dir-path))
How does vb Delete the options in the list?
Private Sub commandementclick ()
For I = 0 To List1.ListCount-1
If InStr (List1.List (I), "BC")> 0 Then List1.RemoveItem I
Next
End Sub
Vb list automatically jumps to the next row after deleting the selected row
Private Sub listdomainkeydown (KeyCode As Integer, Shift As Integer)
If KeyCode = 46 And List1.ListIndex>-1 Then
A = List1.ListIndex
List1.RemoveItem List1.ListIndex
If a <> List1.ListCount Then
List1.ListIndex =
Else
List1.ListIndex = a-1
End If
End If
End Sub