纯属为了练习haskell, 竟然贴代码都没办法高亮。

challenges/fp-update-list

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的更多相关文章

  1. 对openflow 1.0协议的扩展

    通过这几天对openvswitch代码的分析,以及项目的须要,须要对openflow 1.0进行一定的扩展,发现网上没有这方面的教程,尽管在搞懂ovs代码架构,floodlight controlle ...

  2. Alsa 读取wave文件,并播放wave 文件

    对于一个wave文件,如果需要播放,涉及到几个方面 1.对于wave文件的解析 2.通过解析wave文件,将得到的参数(主要是sampfrequency, bitsperSample,channel) ...

  3. scrapy-redis 分布式爬虫

    为什么要学? Scrapy_redis在scrapy的基础上实现了更多,更强大的功能. 有哪些功能体现? request去重.爬虫持久化.实现分布式爬虫.断点续爬(带爬取的request存在redis ...

  4. 【原创】qlogic网卡软中断不均衡问题分析

    引子 使用qlogic QL45000网卡测试业务性能,发现cpu软中断分布不均衡,而且很有规律,导致cpu空闲也不是很均衡, 会影响业务稳定性. 设备使用3张网卡Qlogic网卡,配置为4*25G模 ...

  5. scrapy入门与进阶

    Scrapy是用纯Python实现一个为了爬取网站数据.提取结构性数据而编写的应用框架,用途非常广泛. 框架的力量,用户只需要定制开发几个模块就可以轻松的实现一个爬虫,用来抓取网页内容以及各种图片,非 ...

  6. Scrapy基础02

    一.start_requests def start_requests(self): cls = self.__class__ if method_is_overridden(cls, Spider, ...

  7. scrapy-redis(一)

    安装scrapy-redis pip install scrapy-redis 从GitHub 上拷贝源码: clone github scrapy-redis源码文件 git clone https ...

  8. scrapy爬虫系列之七--scrapy_redis的使用

    功能点:如何发送携带cookie访问登录后的页面,如何发送post请求登录 简单介绍: 安装:pip3 install scrapy_redis 在scrapy的基础上实现了更多的功能:如reques ...

  9. Scrapy 增量式爬虫

    Scrapy 增量式爬虫 https://blog.csdn.net/mygodit/article/details/83931009 https://blog.csdn.net/mygodit/ar ...

  10. 笔记-scrapy-去重

    笔记-scrapy-去重 1.      scrapy 去重 scrapy 版本:1.5.0 第一步是要找到去重的代码,scrapy在请求入列前去重,具体源码在scheduler.py: def en ...

随机推荐

  1. 廖雪峰Java10加密与安全-5签名算法-2DSA签名算法

    DSA DSA:Digital Signature Algorithm,使用EIGamal数字签名算法,和RSA数字签名相比,DSA更快. DSA只能配合SHA使用: SHA1withDSA SHA2 ...

  2. dubbo入门学习(四)-----dubbo配置

    配置来源 首先,从Dubbo支持的配置来源说起,默认有四种配置来源: JVM System Properties,-D参数 Externalized Configuration,外部化配置 Servi ...

  3. MyISAM 与 innoDB 的选择

    1.MyISAM:默认表类型,它是基于传统的ISAM类型,ISAM是Indexed Sequential Access Method (有索引的顺序访问方法) 的缩写,它是存储记录和文件的标准方法.不 ...

  4. Mybatis编写初始化Dao代码

    第一步:创建User实体类(POJO) package com.xu.pojo; import java.util.Date; /** * * @author 徐亮亮 * Title: User * ...

  5. 入门servlet:request获取请求头数据

    @WebServlet("/RequestDemo2") public class RequestDemo2 extends HttpServlet { protected voi ...

  6. Alpha通道是什么意思,和rgb通道有什么区别

    Alpha通道是什么意思,和rgb通道有什么区别 Alpha通道: 阿尔法通道是一个8位的灰度通道,该通道用256级灰度来记录图像中的透明度信息,定义透明.不透明和半透明区域,其中白表示不透明,黑表示 ...

  7. spring源码学习之AOP(二)

    接着上一篇中的内容! 3.创建代理 在获取了所有的bean对应的增强器之后,便可以进行代理的创建了org.springframework.aop.framework.autoproxy包下的Abstr ...

  8. 华为云DevCloud一枝独秀

    DevOps,是Development和Operations的组合词,是指一组过程.方法与系统的统称,用于促进开发.技术运营和质量保障部门之间的沟通.协作与整合.DevOps是一种重视“软件开发人员( ...

  9. 前端插件--isCroll的使用

    中文文档地址: http://wiki.jikexueyuan.com/project/iscroll-5/ 效果图: <!DOCTYPE html> <html lang=&quo ...

  10. ubuntu 安装 go 编译环境

    参考: http://wiki.ubuntu.org.cn/Golang 从仓库安装(apt-get) sudo apt-get install golang 修改环境变量: vim /etc/env ...