提高在传染媒介的元素力量 [英] Raising elements in a vector to a power
本文介绍了提高在传染媒介的元素力量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图输入一个向量和参数p,它又会将向量的每个元素提升为幂p。到目前为止,我已经尝试映射数字塔功能的力量,但这已被证明是不成功的。将向量的每个元素提升为幂p的最简单的方法是什么?
I am trying to input a vector and parameter p, which in turn should raise each element of the vector to the power p. So far I have tried mapping the numeric tower function power, but that has proved unsuccessful. What would be the easiest way to raise each element of a vector to a power p?
(defn p' [x p]
(map power x p))
推荐答案
例如:
(defn compute [exp numbers]
(map #(power exp %) numbers))
有关详细信息,请在您的REPL中键入以下内容:
For more information, type the following in your REPL:
(doc map)
这篇关于提高在传染媒介的元素力量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文