纯属为了练习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. spring-cloud服务网关中的Timeout设置

    本文转载自:https://segmentfault.com/a/1190000014370360 大家在初次使用spring-cloud的gateway的时候,肯定会被里面各种的Timeout搞得晕 ...

  2. idea如何清晰地查看java类的继承结构及该类的所有方法?

    转载自:https://blog.csdn.net/luo609630199/article/details/82192938 我们在世用idea是平时除了编码外,有时我们需要查看源码或者别人写的代码 ...

  3. vue 路由重定向

  4. Ceisum官方教程1 -- 开始

    原文地址:https://cesium.com/docs/tutorials/getting-started/ 学会使用全球地形.影像.3d tile(模型切片).地理编码创建一个Cesium程序. ...

  5. Spring BatchSqlUpdate.updateByNamedParam例子

    关键在于定义参数和sql语句,代码如下: int dstColCount=dstColNamesList.size(); String insSql="insert into "+ ...

  6. 2019-7-29-Roslyn-使用-Target-替换占位符方式生成-nuget-打包

    title author date CreateTime categories Roslyn 使用 Target 替换占位符方式生成 nuget 打包 lindexi 2019-7-29 10:1:1 ...

  7. cmd命令调用powershell脚本方法

    cmd方法: powershell -command ". ('ps1脚本路径'); WriteInfo  -param 'param参数值'" ps1脚本代码: function ...

  8. TZ_05_Spring_Proxy基于接口的动态代理和基于类的动态代理

    代理:为了增强方法在不添加代码的情况下 1.Proxy基于接口的动态代理 /** * 模拟一个消费者 * @author Administrator * */ public class Client ...

  9. iview 小问题笔记

    总结一下用 iview 组件期间遇到的小问题.一边做项目一边做笔记. 官方文档:iview API 按需引入: 1,iview 分页组件 <Page :total="aboutPage ...

  10. 用javascript实现简单的用户登录验证

    用javascript实现简单的用户登录验证 <!DOCTYPE html> <html lang="en"> <head> <meta ...