How to write Native Erlang list functions in CouchDB

Viewed 430

I am trying to write Erlang list functions in CouchDB, however, I am not familiar with the data types returned, and how to manipulate them accordingly. I would like some one to show me how to translate the simple Javascript List function below into an Erlang list function. That would be a good point for me to start.

function(head, req) {
var row,resp={},data=[];
  if(head){
    resp["total_rows"] = head.total_rows;   
  }  
  while(row = getRow()) {
    data.push(row);
  }
  resp.rows = data;
  return JSON.stringify(resp);
}

Thanks, in advance.

1 Answers
Related