Skip to content

Languages

ptol edited this page Mar 20, 2017 · 5 revisions

Examples of a generated code from Oczor

JavaScript

x1 = 1

x2 = 
  foo = 1
  bar = 1


func x y = x + y + 1



x3 = func 1 2

func2 x = 
  temp = x == 1
  in not (temp && false)

  var x1 = 1;

  var x2 = {
    foo : 1,
    bar : 1
  };

  var func = function(x,y){
    return x + y + 1;
  };

  var x3 = func(1,2);

  var func2 = function(x){
    var temp = x === 1;
    return !(temp && false);
  };

Lua

x1 = 1

x2 = 
  foo = 1
  bar = 1


func x y = x + y + 1



x3 = func 1 2

func2 x = 
  temp = x == 1
  in not (temp && false)

  local x1 = 1

  local x2 = {
    foo = 1,
    bar = 1
  }

  local func = function(x,y)
    return ((x + y) + 1)
  end

  local x3 = func(1, 2)

  local func2 = function(x)
    local temp = (x == 1)
    return (not (temp and false))
  end

Ruby

x1 = 1

x2 = 
  foo = 1
  bar = 1


func x y = x + y + 1



x3 = func 1 2

func2 x = 
  temp = x == 1
  in not (temp && false)

  x1 = 1

  x2 = {
    :foo => 1,
    :bar => 1
  }

  func = ->(x,y) do
    return x + y + 1
  end

  x3 = func.(1, 2)

  func2 = ->(x) do
    temp = x == 1
    return !(temp && false)
  end

Emacs Lisp




x1 = 1

x2 = 
  foo = 1
  bar = 1

func x y = x + y + 1

x3 = func 1 2

func2 x = 
  temp = x == 1
  in not (temp && false)

(let (
  (x1 nil)
  (x2 nil)
  (func nil)
  (x3 nil)
  (func2 nil))
  
  (setq x1 1)
  
  (setq x2 (oc-hash-from-plist (list
    'foo 1
    'bar 1)))
    
  (setq func (lambda (x y) (+ (+ x y) 1)))
  
  (setq x3 (funcall func 1 2))
  
  (setq func2 (lambda (x) (let (
    (temp nil)) 
    (setq temp (eql x 1))
    (not (and temp nil))))))
Clone this wiki locally