buzz_syntax_cheatsheet

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revisionBoth sides next revision
buzz_syntax_cheatsheet [2016/04/09 22:03] rootbuzz_syntax_cheatsheet [2016/09/02 20:27] ilpincy
Line 5: Line 5:
 ^ File inclusion | <code buzz>include "otherfile.bzz" ^ File inclusion | <code buzz>include "otherfile.bzz"
  
-# NOTE: A specific file can be included only once. Any 'include' statement for a file is ignored after the first inclusion occurred. Relative paths are automatically transformed into absolute paths before including a file.</code>|+# NOTE: A specific file can be included only once. 
 +Any 'include' statement for a file is ignored after the first inclusion 
 +occurred. 
 +Relative paths are automatically transformed into absolute paths before 
 +including a file.</code>|
 ^ Variables | <code buzz># assignment (by default variables are global) ^ Variables | <code buzz># assignment (by default variables are global)
 x = 2.55   # number x = 2.55   # number
Line 107: Line 111:
  
 # creating a lambda # creating a lambda
-= function(a, b) {+lambda = function(a, b) {
    return a + b    return a + b
-}</code> |+} 
 +lambda(1,2)</code> |
 ^ Math |<code buzz># all the math functions are part of the 'math' table ^ Math |<code buzz># all the math functions are part of the 'math' table
  
Line 127: Line 132:
    v1.y = v1.y + v2.y    v1.y = v1.y + v2.y
 } }
-v1 = { x=1, y=2 } +v1 = { .x=1, .y=2 } 
-v2 = { x=3, y=1 }+v2 = { .x=3, .y=1 }
 vec2_sum(v1, v2) vec2_sum(v1, v2)
  
Line 176: Line 181:
   function(rid, data) {   function(rid, data) {
     log("robot ", rid, ": ",     log("robot ", rid, ": ",
-        "distance  = ", data.distance, ", " +        "distance  = ", data.distance, ", ", 
-        "azimuth   = ", data.azimuth, ", "+        "azimuth   = ", data.azimuth, ", ",
         "elevation = ", data.elevation) })         "elevation = ", data.elevation) })
  
Line 189: Line 194:
           math.sin(data.azimuth)           math.sin(data.azimuth)
     c.z = data.distance * math.sin(data.elevation)     c.z = data.distance * math.sin(data.elevation)
-    return c })+    return c 
 +  })
  
 # Reduction (accum is a table) # Reduction (accum is a table)
Line 198: Line 204:
     accum.z = accum.z + data.z     accum.z = accum.z + data.z
     return accum     return accum
-  }, {x=0, y=0, z=0})+  }, {.x=0, .y=0, .z=0})
  
 # Filtering # Filtering
  • buzz_syntax_cheatsheet.txt
  • Last modified: 2018/03/23 18:17
  • by jayam