我正在尝试创建一个程序来对列表进行排序,然后将列表中的每个部分分组到单独的列表中,并将其输出到列表列表中.这是一个应该更清楚的检查:
> (sort-lists > '())
empty
> (sort-lists < '(1 2 3))
(list (list 1 2 3))
> (sort-lists >= '(2 2 2 2))
(list (list 2 2 2 2))
> (sort-lists < '(5 4 3 2 1))
(list (list 5) (list 4) (list 3) (list 2) (list 1))
> (sort-lists < '(1 2 3 4 2 3 4 5 6 1 2 9 8 7))
(list
(list 1 2 3 4)
(list 2 3 4 5 6)
(list 1 …
Run Code Online (Sandbox Code Playgroud) 在 ISL 中,如何创建一个递归 append
函数,该函数接受两个列表并返回第一个列表的所有最高位置元素和第二个列表的最高位置元素的列表(不使用lambda
or append
)?
基本上,支持这些检查的函数需要:
(check-expect (append-test '(a b c) '(d e f g h)) (list 'a 'b 'c 'd 'e 'f 'g 'h))
(check-expect (append-test '() '(7 2 0 1 8 3 4)) (list 7 2 0 1 8 3 4))
Run Code Online (Sandbox Code Playgroud)
我觉得它肯定会使用map
,因为这是我们最近一直关注的重点。这是我所拥有的,它确实有效,但我想知道是否有一种方法可以使用 map、foldr、foldl、filter 或类似的东西来简化它。
这是我到目前为止所拥有的:
(define (append-test lst1 lst2)
(cond
[(and (empty? lst1)(empty? lst2)) '()]
[(empty? lst1) lst2]
[(empty? lst2) lst1]
[else (cons (first (first (list lst1 lst2)))
(append-test …
Run Code Online (Sandbox Code Playgroud) 如何在Swift中更改大标题导航栏的字体?
我无法找到涵盖实现带有大标题的导航栏的自定义字体的线程。
我正在尝试使用标题为“ ??????????? W8.ttc”的字体。这似乎已预装在我的Mac上。字体书中的名称是:“ Hiragino Kaku Gothic StdN”。
这是我尝试过的:
self.navigationController?.navigationBar.largeTitleTextAttributes = [NSAttributedString.Key.font: UIFont(name: "???????????-W8", size: 20)!]
Run Code Online (Sandbox Code Playgroud)
和
self.navigationController?.navigationBar.largeTitleTextAttributes = [NSAttributedString.Key.font: UIFont(name: "???????????W8", size: 20)!]
Run Code Online (Sandbox Code Playgroud)
和
self.navigationController?.navigationBar.largeTitleTextAttributes = [NSAttributedString.Key.font: UIFont(name: "Hiragino Kaku Gothic StdN", size: 20)!]
Run Code Online (Sandbox Code Playgroud)
字体文件名使用其他语言还是其他问题?