比较haskell中的字符串内容 [英] compare string contents in haskell

查看:822
本文介绍了比较haskell中的字符串内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个字符串列表

例如:

I have a 2 lists of strings
eg:

listx = ["name","age","rank"]
input = ["name","age"]

如何比较两个列表以检查 listx 是否包含name

How can I compare the two lists to check whether the listx contains "name" & "age" given in input?

推荐答案

这是家庭作业吗? :)

Is this homework? :)

您需要创建一个或两个递归函数来遍历这两个列表,并搜索输入中的每个字符串。

You need to create one or two recursive functions to walk through both lists, and search for every string in the input.

或者,你可以在前奏中查找一些有用的功能。

Or, you could look up some good functions in the Prelude that helps here.

这篇关于比较haskell中的字符串内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆