当给定的参数是两个项目和一个列表时,如何在 DrScheme 的列表中用另一个项目替换一个项目? [英] How to replace an item by another in a list in DrScheme when given paramters are two items and a list?

查看:13
本文介绍了当给定的参数是两个项目和一个列表时,如何在 DrScheme 的列表中用另一个项目替换一个项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当给定的参数是两个项目和一个列表时,如何在 DrScheme 的列表中用另一个项目替换一个项目?

How to replace an item by another in a list in DrScheme when given paramters are two items and a list?

推荐答案

map 与函数一起使用,该函数在其参数等于要替换的项时返回替换项,否则返回该参数.

Use map with a function which returns the replacement item when its argument is equal to the item you want to replace and the argument otherwise.

这篇关于当给定的参数是两个项目和一个列表时,如何在 DrScheme 的列表中用另一个项目替换一个项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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