小编Pau*_*cer的帖子

为什么声明是必要的

我目前正在教同事.Net,他问我一个困扰我的问题.

我们为什么要申报?

如果var是隐式类型,为什么我们甚至要声明?

Animal animal = new Animal();
Run Code Online (Sandbox Code Playgroud)

var animal = new Animal();
Run Code Online (Sandbox Code Playgroud)

可能成为

animal = new Animal();
Run Code Online (Sandbox Code Playgroud)

隐式类型仍然意味着这是一个静态类型的变量.

如果为变量分配了两种不同的类型,如果它们不共享基类(除了对象),则可能是编译器错误.

是否有技术原因无法完成或风格上我们喜欢有没有

.net c# variables clr declaration

13
推荐指数
3
解决办法
634
查看次数

maven 编译错误 - [ERROR] 不可解析的导入 POM:无法传输工件

Maven 新手,可能是新手错误。

我正在做 jenkins 课程的复数介绍。我们http://github.com/g0t4/jenkins2-course-spring-boot在其子目录中克隆 git 存储库,其中jenkins2-course-spring-boot\spring-boot-samples\spring-boot-sample-atmosphere有以下 pom.xml 文件:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <parent>
                <!-- Your own application should inherit from spring-boot-starter-parent -->
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-samples</artifactId>
                <version>1.4.0.BUILD-SNAPSHOT</version>
        </parent>
        <artifactId>spring-boot-sample-atmosphere</artifactId>
        <name>Spring Boot Atmosphere Sample</name>
        <description>Spring Boot Atmosphere Sample</description>
        <url>http://projects.spring.io/spring-boot/</url>
        <organization>
                <name>Pivotal Software, Inc.</name>
                <url>http://www.spring.io</url>
        </organization>
        <properties>
                <main.basedir>${basedir}/../..</main.basedir>
        </properties>
        <dependencies>
                <dependency>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-starter-web</artifactId>
                </dependency>
                <dependency>
                        <groupId>javax.inject</groupId>
                        <artifactId>javax.inject</artifactId>
                        <version>1</version>
                </dependency>
                <dependency>
                        <groupId>org.atmosphere</groupId>
                        <artifactId>atmosphere-runtime</artifactId>
                        <version>2.2.4</version>
                </dependency>
                <dependency>
                        <groupId>org.webjars</groupId>
                        <artifactId>atmosphere-javascript</artifactId>
                        <version>2.2.3</version>
                </dependency>
                <dependency>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-starter-test</artifactId>
                        <scope>test</scope>
                </dependency> …
Run Code Online (Sandbox Code Playgroud)

maven

13
推荐指数
2
解决办法
4392
查看次数

使用foldr 将位转换为int 向前

位数组从右到左,例如 [0,1,0,1] = 10 可以通过以下方式读取:

binToInt = foldr (\x xs -> x + 2 * xs) 0  
Run Code Online (Sandbox Code Playgroud)

我想从左到右阅读,例如 [1,0,1,0] = 10

我认为这会起作用:

binToInt' = foldr (\x xs -> (x * ((^) 2 (length xs)) + xs) 0
Run Code Online (Sandbox Code Playgroud)

但是我收到错误:

Couldn't match type `t0 a0' with `Int' 
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

(作为解决方法,我正在反转 binToInt 的结果)

haskell

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

我在哪个文件中找到( - >)的定义

我在哪个文件中找到( - >)的定义

我的假设是,这是在GHC.something的某处定义的,但搜索起来很棘手.

haskell

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

标签 统计

haskell ×2

.net ×1

c# ×1

clr ×1

declaration ×1

maven ×1

variables ×1