如何将结果存储到HP OpenVMS DCL中的变量中?(How to store a result to a variable in HP OpenVMS DCL?)
我想将程序的输出保存到变量中。
我使用以下方法,但失败。
$ PIPE RUN TEST | DEFINE/JOB VALUE @SYS$PIPE $ x = f$logical("VALUE")
我得到一个错误:
%DCL-W-MAXPARM, too many parameters - reenter command with fewer parameters \WORLD\
I want to save the output of a program to a variable.
I use the following approach ,but fail.
$ PIPE RUN TEST | DEFINE/JOB VALUE @SYS$PIPE $ x = f$logical("VALUE")
I got an error:
%DCL-W-MAXPARM, too many parameters - reenter command with fewer parameters \WORLD\
reference : How to assign the output of a program to a variable in a DCL com script on VMS?
原文:https://stackoverflow.com/questions/34890693
最满意答案
喜欢这个
ghci> import Data.Char ghci> import Data.List ghci> groupBy (const isAlphaNum) "A bunch of words and numbers34" ["A"," bunch"," of"," words"," and"," numbers34"]
要么
ghci> groupBy (const isAlpha) "A bunch of words and numbers34" ["A"," bunch"," of"," words"," and"," numbers","3","4"]
编辑:由于没有迹象表明解决方案已被发现的扩展问题,为了保持标准的SO我将完成问题的答案:
import Data.List isVowel :: Char -> Bool isVowel c = c `elem` "aeiouy" bothVowelConsonant :: Char -> Char -> Bool bothVowelConsonant a b = all isVowel [a,b] || not (any isVowel [a,b]) splitByVowel :: String -> [String] splitByVowel s = groupBy bothVowelConsonant s
Like this
ghci> import Data.Char ghci> import Data.List ghci> groupBy (const isAlphaNum) "A bunch of words and numbers34" ["A"," bunch"," of"," words"," and"," numbers34"]
Or
ghci> groupBy (const isAlpha) "A bunch of words and numbers34" ["A"," bunch"," of"," words"," and"," numbers","3","4"]
Edit: Since there has been no indication that a solution has been found to the extended problem, in the interest of keeping up the standard of SO I shall complete the answer to the problem:
import Data.List isVowel :: Char -> Bool isVowel c = c `elem` "aeiouy" bothVowelConsonant :: Char -> Char -> Bool bothVowelConsonant a b = all isVowel [a,b] || not (any isVowel [a,b]) splitByVowel :: String -> [String] splitByVowel s = groupBy bothVowelConsonant s
相关问答
更多-
但在上面的第二个示例中,它将每个元素的列表分开,但谓词应该计算为False 。 在第二个例子中,它也评估每两个连续的元素。 它的工作const isAlphaNum是const isAlphaNum 。 这意味着这种类型是: const isAlphaNum :: b -> Char -> Bool 它因此调用组的开始和元素的函数,但它只考虑第二个元素 。 因此,如果我们用groupBy (const isAlphaNum) "split this"调用它,它将评估: succs 2nd con ...
-
用于Haskell id功能(Uses for Haskell id function)[2022-05-24]
它作为高阶函数 (函数作为参数的函数)的参数很有用,您希望某些特定值保持不变。 示例1 :如果它位于Just中,则单独留下一个值,否则返回默认值7。 Prelude Data.Maybe> :t maybe maybe :: b -> (a -> b) -> Maybe a -> b Prelude Data.Maybe> maybe 7 id (Just 2) 2 示例2 :通过折叠构建函数: Prelude Data.Maybe> :t foldr (.) id [(+2), (*7)] :: (N ... -
Haskell基本函数定义(Haskell basic function definition)[2023-05-14]
您需要为它提供一个函数 ,更具体地说,是一个endofunction (将任何类型映射到自身)。 例如, *Main> iter 3 sqrt 256 2.0 当然,这也可以是自定义功能 *Main> let f x = x+2 *Main> iter 3 f 7 13 甚至是在调用中定义的匿名的: *Main> iter 3 (\str -> "("++str++")") "..." "(((...)))" You need to give it a function, more specifica ... -
zip在Haskell中的函数(zipWith function in Haskell)[2021-09-02]
zipWith在两个列表的每个成员上成对调用给定的函数。 所以zipWith f [a,b,c] [x,y,z]计算结果为[fax, fby, fcz] 。 在这种情况下, f是zipWith (*)并且列表中的元素也是列表,因此您可以: [ zipWith (*) [1,2,3] [3,2,2], zipWith (*) [3,5,6] [3,4,5], zipWith (*) [2,3,4] [5,4,3] ] 现在, zipWith的内部调用将内部列表的元素成对地相乘,因此您可以: [ [ ... -
喜欢这个 ghci> import Data.Char ghci> import Data.List ghci> groupBy (const isAlphaNum) "A bunch of words and numbers34" ["A"," bunch"," of"," words"," and"," numbers34"] 要么 ghci> groupBy (const isAlpha) "A bunch of words and numbers34" ["A"," bunch"," of"," ...
-
基本的Haskell递归函数(Basic Haskell Recursive Function)[2021-12-15]
好的 - 你不知何故必须带着你的标志 ,所以显而易见的解决方案是用一个参数来做(然后添加一个版本来修复第一个调用的这个参数): alternateSum' :: Num a => a -> [a] -> a alternateSum' _ [] = 0 alternateSum' f (h:tl) = f * h + alternateSum' (-f) tl alternateSum :: [Integer] -> Integer alternateSum ns = alternateSum' ... -
我们有: applyTwice f x = f(f x) 这只有在x和fx的类型是等价的时候才有意义(否则你怎么能够将fx传递给带x的函数?)。 因此,可以说applyTwice需要2个输入参数: 采用类型t并返回相同类型t的函数 某种类型的输入 现在这个输入可以是任何类型,比如t1。 但是你也必须能够把这个函数应用到这个输入中,所以输入的类型也必须是t。 放在一起,我们得到签名: applyTwice :: (t -> t) -> t -> t 请记住,只有最后一个词是返回类型,而其他所有词都是输入类 ...
-
Haskell函数过程(Haskell function process)[2022-03-07]
head返回列表的第一个元素。 在这种情况下,它返回列表tail integerList的第一个元素。 tail返回没有第一个元素的原始列表。 原始列表是integerList ,它绑定到[1] ++ integerList 。 ++运算符连接两个列表,因此结果列表为1 : integerList 。 将tail应用于此列表会产生integerList ,因此tail integerList只会产生integerList 。 回到开头:用integerList替换tail integerList (因为这就 ... -
指数函数Haskell(Exponentiation function Haskell)[2022-11-23]
教会数字算法往往涉及相当奇怪的类型,因此它在Haskell中并不像在无类型语言中那样优雅。 原则上,教会数字是一种功能,它接受任何内同态并在同一类型上给出另一种内同态,即 five :: (a -> a) -> a -> a 适用于任何类型a ,即它真正意味着 {-# LANGUAGE ExplicitForall, UnicodeSyntax #-} five :: ∀ a . (a -> a) -> a -> a 当你用这样的数字做有趣的算术时,技巧是计算的各个组成部分实际上可能正在处理不同类型的内 ... -
groupBy :: (a -> a -> Bool) -> [a] -> [[a]]使用组的第一个成员作为参考。 所以,如果你写: groupBy eq (x:x2:x3) 它将 - 如果满足eq x x2 ,则调用eq x x3以检查x3也属于同一组。 所以电话是: arg1 | arg2 | (>) `on` (*1) -5 | -4 | False -4 | 5 | False 5 | 4 | True 5 | -2 | True 5 | -3 | ...