小编fig*_*kie的帖子

托管类型的全局对象

有没有办法声明/定义托管类型的全局/静态对象?

managed-c++ c++-cli global-variables

3
推荐指数
1
解决办法
2622
查看次数

如何根据输入返回调用另一个函数的函数?

我真的很新Haskell,我需要返回一个"修改"输入函数的函数.

我想你不能复制和修改原始函数(基于某些条件)所以你必须直接实现自己的行为,然后调用原始函数?

这是我的方法:

switchFirstEgg eggCarton = if eggCarton 1 == 0
                                then switchedCarton where switchedCarton position = if position == 1 then 2 else eggCarton position
                                else if eggCarton 1 == 1
                                        then switchedCarton where switchedCarton position = if position == 1 then 0 else eggCarton position
                                        else if eggCarton 1 == 2
                                                then switchedCarton where switchedCarton position = if position == 1 then 1 else eggCarton position
                                                else switchedCarton where switchedCarton position = eggCarton position
Run Code Online (Sandbox Code Playgroud)

我从GHCI得到的错误是

haskell/eggcartons.hs:42:54:输入'在哪里'解析错误

它指向第一个单词之后的第一个单词where …

haskell ghci

1
推荐指数
1
解决办法
225
查看次数

标签 统计

c++-cli ×1

ghci ×1

global-variables ×1

haskell ×1

managed-c++ ×1