-
Notifications
You must be signed in to change notification settings - Fork 0
Home
thautwarm edited this page Aug 9, 2017
·
11 revisions
Welcome to the flowpython wiki!
Here are some tutorials about Flowpython.
-
where>> where = 1 >> where += where where: where += 1 >> where >> 3
from math import pi r = 1 # the radius h = 10 # the height S = (2*S_top + S_side) where: S_top = pi*r**2 S_side = C * h where: C = 2*pi*r
-
lambda- format
lambda x: f(x) <=> .x -> f(x) <=> as-with x def f(x)
- curry
.x -> .y -> ret where: ret = f(x,y) as-with x def as y def ret where: ret = f(x,y)
-
pattern-matchingthe default mode is
[==].condic 1: [>] case 0 => assert 1 > 0 condic 1: [is not] case 1 => assert 1 is not 1 case 1 => assert 1 == 1 otherwise => True condic 1: (type) case int => assert type(1) == int condic 1: (.x->x+3) case 1 => assert x+3 == 1 where: x=1 (.x->x+3) case 4 => assert x+3 == 4 where: x=1 tomap = as-with f def as var def ret where: ret = list(map(f,var)) condic[] [1,2,3]: +(type) case (*a,b):(int,int,int) => assert [*a,b] == x and tomap(type)(x) == [int,int,int] where: x = [1,2,3] condic +[in] 1: case a:{1,2,3} => assert x in y where: x = 1 y = {1,2,3} condic +[>] (10,20): case (a,b):(5,10) => assert (a,b) > (5,10)