syntax.us Let the syntax do the talking
Blog Contact Posts Questions Tags Hire Me

Question:
What is 2016_0103 Code Challenge?

The 2016_0103 Code Challenge is a learning exercise for students attending Dan's Linux JavaScript Class at 3pm on 2016-01-03 at Hacker Dojo:

http://www.meetup.com/Dans-Linux-JavaScript-Class/events/227665144

In class we study a Node.js implementation of Deep500:

https://github.com/danbikle/deep500/tree/cc2016_0103/d5n

Questions

  • How to run CoffeeScript in browser?
  • How to rewrite this function so it is easy to transform to CoffeeScript:
    function clog(x){console.log(x); return 'clog done.';};
    ??
  • How to transform this function into CoffeeScript:
    clog = function(x){console.log(x); return 'clog done.';};
    ??
  • What is a REPL?
  • What is the CoffeeScript REPL?
  • How to start the CoffeeScript REPL?
  • How to start the Node.js REPL?
  • When should I add semi-colon to CoffeeScript syntax?
  • How to run JavaScript inside of CoffeScript?
  • How to rewrite this JS syntax into CoffeScript
    
    var a1_a      = [1,2,3,4,5,6];
    var pctlead_a = [0,0,0,0,0,0];
    for(i=0;i<a1_a.length-1;i++){
      follower_n   = a1_a[i];
      leader_n     = a1_a[i+1];
      pctlead_n    = 100.0 * (leader_n - follower_n) / follower_n;
      pctlead_a[i] = pctlead_n;
    }
    console.log(pctlead_a);
    
    ??
  • What does this syntax do:
    
    rl = require('readline').createInterface(
      input: require('fs').createReadStream('../public/csv/GSPC.csv'))
    global.myarray = []
    rl.on 'line', (line)->
      global.myarray.push line
      return
    # Upon close of reading the file, I should pass the array to a callback function.
    rl.on 'close', ->
      cb1(global.myarray)
      return
    
    ??
  • What does this syntax do:
    
    cb1 = (in_a)->
      if in_a[0].split(',')[0] is 'Date'
        csv_s_a = in_a[1..]
      # I should check again
      csv_a_a = csv_s_a.map (row)->row.split(',')
      d1      = csv_a_a[1][0]
      d2      = csv_a_a[2][0]
      if (d1 > d2) # date1 > date2?
        csv_a_a.reverse()
      ydate_s_a = csv_a_a.map (row_s)->  row_s[0]
      cp_a      = csv_a_a.map (row_s)-> +row_s[4]
    
    ??

That could be considered an adequate code challenge for a two hour Meetup.

If you have questions, e-me:

bikle101@gmail.com


syntax.us Let the syntax do the talking
Blog Contact Posts Questions Tags Hire Me