# Good case for a Lambda function?

**URL:** <https://swi-prolog.discourse.group/t/good-case-for-a-lambda-function/907>\
**Category:** Help!\
**Created:** [July 3, 2019, 1:02am UTC](https://swi-prolog.discourse.group/t/good-case-for-a-lambda-function/907 "2019-07-03T01:02:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![prodog](https://avatars.discourse-cdn.com/v4/letter/p/57b2e6/32.png) [@prodog](https://swi-prolog.discourse.group/u/prodog)\
**Post date:** [July 3, 2019, 1:02am UTC](https://swi-prolog.discourse.group/t/good-case-for-a-lambda-function/907/1 "2019-07-03T01:02:25Z")

</div>

I’m using: SWI-Prolog version 8.0.2.

Is the code below a good case for refactoring using a Lambda function for the `findall()` operation? If so, can someone show me how this would be done? The code seems a bit verbose too me (I wrote it so no one will be offended if you agree that it’s too vebose).

Also, I assume I would need to include the **yall** package and if so, will that package be allowed in the PEngines sandbox?

```prolog
		% ----->>>>> adjective_filter_word.
		
		% These are the words that we don't want in the adjective words list 
		%	when building the an adjectival noun phrase.
		adjective_filter_word(unlocks) :- !.
		
		% ----->>>>> is_not_filter_word
		
		is_not_filter_word(AdjWordsList, Word) :-
			member(Word, AdjWordsList),
			\+ adjective_filter_word(Word).
		
		% Empty adjective words list.
		filter_adjective_words_list_1([], []) :- !.
		
		filter_adjective_words_list_1(AdjWordsList, FilteredWordsList) :-
			findall(Word, is_not_filter_word(AdjWordsList, Word), FilteredWordsList).

```

---

<div class="post-metadata">

**Author:** ![prodog](https://avatars.discourse-cdn.com/v4/letter/p/57b2e6/32.png) [@prodog](https://swi-prolog.discourse.group/u/prodog)\
**Post date:** [July 3, 2019, 11:14am UTC](https://swi-prolog.discourse.group/t/good-case-for-a-lambda-function/907/3 "2019-07-03T11:14:28Z")

</div>

Wow, quite the _Hall of Fame_ list of authors on that paper! Pretty much a programming dream team for any company running a production version of Prolog. 🙂

Thanks for the link! That one should go in the forum introductory E-mail, my opinion.
