list - How to filter in Prolog with SWISH
问题描述
I need to make a predicate called fAtomPairs so that given an atom (first argument), and a list of pairs (each pair is in turn a list of two atoms), unify a third parameter with the filtered list of pairs by selecting only those pairs that have as their first component the atom which is the first argument.
For example :
fAtomPairs(sA,[[basA,absAb],[ab,bbsA],[sA,abbsB],[bsA,sAsB],[sA,bb]],X)
must result in
X = [[sA,abbsB],[sA,bb]]
How can I do this?, I'm currently working in SWISH
解决方案
推荐阅读
- typescript - 在 TypeScript 中键入由继承方法调用的重写方法(错误?)
- javascript - 无法在快递服务器中找到从角度文件上传器(npm 库)发送的 pdf 文件
- javascript - 在 openlayers 3 中搜索标记
- react-native - 如何在按钮按下时显示 react-native-push-notification-popup?
- flutter - 颤振和以太坊:未处理的异常:RangeError:值不在范围内:32
- elasticsearch - 如何在 Elasticsearch 中的字段上强制唯一性以避免重复
- python-3.x - CuDNNLSTM 在 TensorFlow2 中比 LSTM 慢
- xml - 使用 xsl:copy-of 时 xsl:namespace-alias 无法按预期工作
- iis - 每个请求的 Kerberos 挑战
- go - 如何使用 Go 语言从 bitbucket 上的远程存储库中获取文件