在hakell中排序一个元组? [英] Sort a Tuple in hakell?

查看:105
本文介绍了在hakell中排序一个元组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为拼字游戏编写代码,但我遇到了如何发送单词和得分元组的问题([(XXX,1),(ZZZ,11),(WWW ,11),(YYY,8)])函数。甚至该函数如何按降序对元组进行排序,并以最高分数重新运行所有元组。

谢谢

I was trying to write a code for scrabble game but i am facing a problem how to send the tuple of the word and score ([("XXX", 1), ("ZZZ", 11), ("WWW",11), ("YYY, 8)]) to a function. And even how that function sorts the tuple in descending order and rerun all those tuples with the maximum score.
Thanks

推荐答案

请参阅此Stack Overflow问题:在Haskell中,如何使用内置的sortBy函数对对列表进行排序(元组)? [ ^ ]。
See this Stack Overflow question: "In Haskell, how can I use the built in sortBy function to sort a list of pairs(tuple)?"[^].


这篇关于在hakell中排序一个元组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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