法罗:#( $H $e $l $l $o ).'你好' Finder 中没有示例
当我转到查找器并选择“示例”时,我不知道如何找到将 #( $H $e $l $l $o ).
转换为 的方法“你好”。
MethodFinder new findMethodsByExampleInput: #( $H $e $l $l $o ) andExpectedResult: 'Hello'.
也不起作用。
知道怎么做(*),但我想知道如何使用 Finder。
我猜 Finder 根本找不到它?我错过了什么吗?
(*) 例如,一种方法是:String newFrom: #( $H $e $l $l $o ).
。另一种方法是: #($H $e $l $l $o) 将: '' 注入: [ :acc :el | acc, (el asString) ].
(尽管我不希望 Finder 找到第二种方式)
When I go to the finder and select "Examples" then I can't figure out how to find a method that turns #( $H $e $l $l $o ).
into 'Hello'
. Nor does MethodFinder new findMethodsByExampleInput: #( $H $e $l $l $o ) andExpectedResult: 'Hello'.
work.
know how to do it(*), but I want to know how to utilize the Finder.
I guess the Finder simply can't find it? Am I missing something?
(*) For example, one way to do it i: String newFrom: #( $H $e $l $l $o ).
. Another way would be: #($H $e $l $l $o) inject: '' into: [ :acc :el | acc, (el asString) ].
(though I would not expect the second way to be found by the Finder)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您将其视为将字符集合添加到字符串而不是将集合转换为字符串,您可以
在 Finder 中搜索:,您将得到结果:
If you think about it like adding a collection of characters to a string rather than converting a collection to a string you can search for:
in the Finder and you will get the results:
它找不到它。
但请注意,发送到
#($H $e $l $l $o)
的方法不会以'Hello'
进行应答。存在的是一种使用参数#($H $e $l $l $o)
发送到String
的方法,该方法将回答'Hello'
。因此,在这种情况下使用MethodFinder
的正确方法是不幸的是,没有探索
#newFrom:
方法(大多数类端方法都没有)。It can't find it.
Note however that there isn't a method that sent to
#($H $e $l $l $o)
would answer with'Hello'
. What there exists is a method that sent toString
with argument#($H $e $l $l $o)
will answer'Hello'
. So, the proper way to usingMethodFinder
in this case would have beenUnfortunately, the
#newFrom:
method is not explored (most class side methods aren't).