hackerrank--- challenges/fp-update-list
纯属为了练习haskell, 竟然贴代码都没办法高亮。
Update the values of a list with their absolute values. The input and output portions will be handled automatically during grading. You only need to write a function with the recommended method signature.
Input Format
There are N integers, each on a new line. These are the N elements of the input array.Output Format
N integers each on a new line; these are the absolute values of the input list, in that order.Sample Input
2
-4
3
-1
23
-4
-54
Sample Output
2
4
3
1
23
4
54
Accpeted Code:
-- Enter your code here. Read input from STDIN. Print output to STDOUT f arr = [if x >= 0 then x else -x | x <- arr] -- Complete this function here -- This section handles the Input/Output and can be used as it is. Do not modify it.
main = do
inputdata <- getContents
mapM_ putStrLn $ map show $ f $ map (read :: String -> Int) $ lines inputdata
hackerrank--- challenges/fp-update-list的更多相关文章
- 对openflow 1.0协议的扩展
通过这几天对openvswitch代码的分析,以及项目的须要,须要对openflow 1.0进行一定的扩展,发现网上没有这方面的教程,尽管在搞懂ovs代码架构,floodlight controlle ...
- Alsa 读取wave文件,并播放wave 文件
对于一个wave文件,如果需要播放,涉及到几个方面 1.对于wave文件的解析 2.通过解析wave文件,将得到的参数(主要是sampfrequency, bitsperSample,channel) ...
- scrapy-redis 分布式爬虫
为什么要学? Scrapy_redis在scrapy的基础上实现了更多,更强大的功能. 有哪些功能体现? request去重.爬虫持久化.实现分布式爬虫.断点续爬(带爬取的request存在redis ...
- 【原创】qlogic网卡软中断不均衡问题分析
引子 使用qlogic QL45000网卡测试业务性能,发现cpu软中断分布不均衡,而且很有规律,导致cpu空闲也不是很均衡, 会影响业务稳定性. 设备使用3张网卡Qlogic网卡,配置为4*25G模 ...
- scrapy入门与进阶
Scrapy是用纯Python实现一个为了爬取网站数据.提取结构性数据而编写的应用框架,用途非常广泛. 框架的力量,用户只需要定制开发几个模块就可以轻松的实现一个爬虫,用来抓取网页内容以及各种图片,非 ...
- Scrapy基础02
一.start_requests def start_requests(self): cls = self.__class__ if method_is_overridden(cls, Spider, ...
- scrapy-redis(一)
安装scrapy-redis pip install scrapy-redis 从GitHub 上拷贝源码: clone github scrapy-redis源码文件 git clone https ...
- scrapy爬虫系列之七--scrapy_redis的使用
功能点:如何发送携带cookie访问登录后的页面,如何发送post请求登录 简单介绍: 安装:pip3 install scrapy_redis 在scrapy的基础上实现了更多的功能:如reques ...
- Scrapy 增量式爬虫
Scrapy 增量式爬虫 https://blog.csdn.net/mygodit/article/details/83931009 https://blog.csdn.net/mygodit/ar ...
- 笔记-scrapy-去重
笔记-scrapy-去重 1. scrapy 去重 scrapy 版本:1.5.0 第一步是要找到去重的代码,scrapy在请求入列前去重,具体源码在scheduler.py: def en ...
随机推荐
- iTerm2配色和去掉profile提示框
效果: 配色方案代码地址: https://github.com/mbadolato/iTerm2-Color-Schemes 点击最右边的绿色区域,再点击 “import”, 打开刚下载解压好的文 ...
- mysql报错:You must reset your password using ALTER USER statement before executing this statement.
新安装mysql后,登录后,执行任何命令都会报错: You must reset your password using ALTER USER statement before executing t ...
- 装配SpringBean(六)--配置文件加载方式
spring中的配置文件有两种: 以XML结尾的spring配置文件 以properties结尾的属性配置文件 在spring中有两种方式加载这两种文件: 通过注解+java配置的方式 通过XML的方 ...
- Java内功修炼系列一观察者模式
观察者模式又称发布-订阅模式,就是观察者通过订阅被观察者,或关注被观察者,从而实时更新观察者的信息.比如我们玩微博的时候,如果关注了一些博主,那么当博主发动态时,在首页微博列表中就会自动更新这些博主发 ...
- 2019-10-11-VisualStudio-配置多进程调试快捷键启动项目
title author date CreateTime categories VisualStudio 配置多进程调试快捷键启动项目 lindexi 2019-10-11 15:33:32 +080 ...
- 使用Python Requests上传表单数据和文件
在Python环境下写一个HTTP客户端,发送POST请求,同时上传表单数据和文件,我们可以使用Requests模块来实现.代码如下: data = { 'name': 'nginx' } files ...
- springcloud的服务提供者与服务消费者
1.说明 springcloud中由服务消费者调用服务提供者一共有两种方法rest和feign 2.feign (1)使用feign的方式进行服务调,搭建服务提供者. 创建一个web项目(服务提供者) ...
- rabbitmq实现单发送单接收
1.创建两个项目.都使其支持rabbitmq (1)在pom.xml文件中添加支持rabbitmq的jar包 <dependency> <groupId>org.springf ...
- centos7.6 安装jdk1.8
1. 下载 jdk-8u211-linux-x64.tar.gz文件. 2. 创建/opt/soft目录,# cd /opt, # mkdir soft, #tar -zxvf jdk-8u211- ...
- 原生js增加,移除类名
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...