I know that FB doesn't have any built-in syntax for list comprehensions like python or
some functional programming languages.
But can they be simulated. Examples would be nice.
list comprehensions in FB?
-
- Posts: 789
- Joined: Jul 26, 2018 18:28
Re: list comprehensions in FB?
You can embed Python code in FB code by compiling against libpython. Search the forum for details.
Re: list comprehensions in FB?
Moved to general as Tips & Tricks is for code examples, not questions.
Re: list comprehensions in FB?
A list comprehension is not simply a list structure. It's a syntax for building lists using functional programming. It's kind of like an SQL query really. In fact in C#, the Linq list comprehension mechanism is used to implement an SQL-like syntax for a variety of data operations.
And according to some wiki, there are even macro-based implementations of list comprehensions for C: https://rosettacode.org/wiki/List_comprehensions#C. I don't understand the C example at all and didn't spend much time looking at it. But I'm sure macros could work in FB also.
And according to some wiki, there are even macro-based implementations of list comprehensions for C: https://rosettacode.org/wiki/List_comprehensions#C. I don't understand the C example at all and didn't spend much time looking at it. But I'm sure macros could work in FB also.
-
- Posts: 538
- Joined: Dec 02, 2011 22:51
- Location: France
Re: list comprehensions in FB?
I designed this one : viewtopic.php?f=8&t=26533
Be welcome trying it.
Be welcome trying it.