0

So, in Frogatto Formula Language we can have a where clause with multiple assignments, like where a = yadda, b = foo

However I can't refer to a in the assignment of b ?

I was hoping to simplify by breaking it into steps, where a = ..., b = ...(refers to var a)...

Note: it doesn't seem to work in where b,a order either:

EVALUATING: [a,b] where b=a+1, a=1
ASSERTION FAILED: Unknown symbol 'a'
[a,b] where b=a+1, a=1
              ^^
Patrick Parker
  • 4,863
  • 4
  • 19
  • 51

1 Answers1

1

Use a ladder of where clauses, like this:

[a,b] where b = a+1 where a = 1

Denivarius
  • 181
  • 2
  • Ok, that works. Do you think the a=1, b=a+1 syntax should be supported in a future version? – Patrick Parker May 20 '18 at 00:57
  • I think we might end up supporting that. It would certainly alleviate some confusion such as yours. – Denivarius May 20 '18 at 01:25
  • 1
    I would recommend newbies to tend to ladders of `where` as much as possible instead of parallel `where` variables, so this way every comma is clearly a separation between two elements in the upmost scope. A parallel `where` clause introduces complexity so a comma could be inside a `where` scope, and the engine could have some problems to know if a comma ends a `where` clause or instead ends the FFL element for which that `where` clause is defining additional variables. – 1737973 May 22 '18 at 09:32