Coder Social home page Coder Social logo

functionalscript / functionalscript Goto Github PK

View Code? Open in Web Editor NEW
40.0 40.0 3.0 856 KB

FunctionalScript is a purely functional subset of JavaScript

License: MIT License

JavaScript 94.60% C++ 1.45% HTML 0.05% Rust 3.74% C# 0.15%
closure functional-programming immutable javascript lambda lazy-evaluation programming-language pure-functional purely-functional typescript

functionalscript's Issues

DJS

  • rename fjson to djs (data javascript), File extensions: .d.cjs, .d.mjs, .d.js.
  • use JS tokenizer
  • identifiers {a:5}
  • big int
  • module.exports = ...
  • constants const a = [3];module.exports = { a: a, b: a }.
    • Deserialization. Make sure we build the correct DAG. Test: const obj = deserialize('...'); if (obj.a !== obj.b) { throw "" }
    • Serialization. const _0=[3];module.exports={a:_0,b:_0}
  • import const a = require('c.d.cjs');module.exports = { a: a, b: a}. Deserialization only.
  • ES6 import import a from 'c.d.mjs';export default { a: a, b: a}.
  • short form const a = 5;module.exports = { a }

Optional, for fun, syntax sugar:

  • comments. Ignore them. Not an error.
  • double/single quote strings

Samples?

Can there be a samples directory with an .md file on how to run them? ("run npm install, run npm run build")?

I think, the following samples could be beneficial:

  1. "99 bottles of beer". Calls itself recursively starting from 99, special casing 1.
  2. "sort numbers" - an equivalent of the following Haskell code:
quickSort []     = []
quickSort (x:xs) = quickSort (filter (<x) xs)
                   ++ [x] ++
                   quickSort (filter (>=x) xs)
  1. Consume a FunctionalScript function from "existing" TypeScript project
  2. Consume a FunctionalScript function from "existing" JavaScript project
  3. Probably, "Hello World" (just to cover another classic example)
  4. A parser? (where functional languages are strong). Could be a URL or DateTime parser.
  5. Expression calculator (+, -, /, %, (), maybe pi constant, log2(), sin(), cos() etc) - the stuff similar to what a typical hardware calculator has.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.