You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -123,13 +123,17 @@ Ranges are the building blocks of Funktion programming. They allow programmers t
123
123
124
124
These types of ranges will not stop until some goal condition is met. For example, a function with an infinite numerical range may end if the program will print on the first input value for the function that is divisible by 152, for instance. However, these types of functions will prematurely end if they reach or pass the bounds of the globally-defined range, if it is defined.
125
125
126
+
NOT IMPLEMENTED YET
127
+
126
128
##### Character Ranges
127
129
128
130
-`` `'a'..'e'` `` → `a b c d e`
129
131
-`` `'y'..'t'` `` → `y x w v u t`
130
132
-`` `'a'..'h' t2t` `` → `a c e g`
131
133
-`` `'Y'..'c'` `` → `` Y Z [ \ ] ^ _ ` a b c ``
132
134
135
+
NOT IMPLEMENTED YET
136
+
133
137
#### Range Scoping
134
138
135
139
##### Global Scope
@@ -160,7 +164,7 @@ If a local scope exceeds the bounds of a given global scope, the program will le
160
164
#### Calling Functions
161
165
162
166
-`f(x).step(3)` - Calls the function 3 times.
163
-
-`print(f(x):2)` - Prints the output of the function until 2.
167
+
-`print(x:2)` - Prints the output of the function until 2.
164
168
165
169
In Funktion, any time a function is called with `.step()`, the function will generate the next output over the given time step, moving forward from the first step to also generate the next step when initially called. By default, `.step()` will step one defined time step. If the time step is defined as 2, it will step through the input value by 2. If a function with a time step of 2 calls itself with `.step(2)`, it will step twice, generating twice, stepping through the input value by 4. The local defined time step takes precedence over the global time step for all functions in the given program, which is 1 by default if not defined at the start of the program. The step value need not align with the global or even local time step, but the function will end generation once the end value is either reached or passed.
166
170
---
@@ -227,17 +231,17 @@ Program below prints the factorial of 5, which will output `120` after iterating
227
231
228
232
factorial(x) = ? x > 1 => x * factorial(x - 1) : 1
229
233
230
-
factorial(x).step(5)
231
-
print(x:5)
234
+
factorial(x).step(5) // Step through 5 times
235
+
print(x:1)
232
236
```
233
237
234
238
**Output:**
235
239
236
240
```
237
-
5
238
-
20
239
-
60
240
-
120
241
+
1
242
+
2
243
+
6
244
+
24
241
245
120
242
246
```
243
247
@@ -250,14 +254,17 @@ print(x:5)
250
254
251
255
f(x) = x
252
256
f(x).step(2)
253
-
G(x) = number(input("Give me a value and I will multiply that sequence with that value."))
257
+
G(x) = input("Give me a value and I will multiply that sequence with that value.")
254
258
255
-
(f(x) * G(x)).step(2)
256
-
print(f(x):5)
259
+
h(x) = f(x) * G(x)
260
+
h(x).step(2)
261
+
print(x:5)
257
262
```
258
263
259
264
**Expected Output:**
260
265
266
+
User Input: 5
267
+
261
268
```
262
269
1
263
270
2
@@ -274,10 +281,13 @@ In this example, `f(x)` generates a sequence of numbers from 1 to 5. When combin
274
281
`15..1` t1t
275
282
276
283
fizzbuzz(x) =
277
-
? x % 15 == 0 => print("fizzbuzz"), fizzbuzz(x).step()
This language is also capable of generating JavaScript code!
371
381
382
+
The example codes below are reformatted for readability. The generator will produce these JavaScript code, but without the nice formatting. Note that unecessary and boilerplate code are removed as well.
383
+
372
384
### Transpiled Function
373
-
These functions will always appear in the transpiled JavaScript code regardless what file is being translated. These functions are used as Funktion has completely
385
+
These functions will always appear in the transpiled JavaScript code regardless what file is being translated. These functions are used as Funktion and JavaScript differ is expressiveness.
The code is reformatted for readability. The generator will produce this code, but without the nice formatting. Note that unecessary and boilerplate code are removed as well.
0 commit comments