GithubHelp home page GithubHelp logo

functionalscript / functionalscript Goto Github PK

View Code? Open in Web Editor NEW
39.0 4.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%
javascript functional-programming typescript lambda closure pure-functional programming-language lazy-evaluation immutable purely-functional

functionalscript's Introduction

FunctionalScript

FunctionalScript is a purely functional programming language and a strict subset of ECMAScript/JavaScript. It's inspired by

A brief description of FunctionalScript Programming Language.

Create a new FunctionalScript repository on GitHub here.

Learn more about

Design Principles

In FunctionalScript:

  • Any module is a valid JavaScript module. No additional build steps are required.
  • Code should not have side-effects. Any JavaScript statement, expression, or function that has a side effect is not allowed in FunctionalScript. There are no exceptions to this rule, such as unsafe code, which can be found in Rust, C#, and other languages.
  • A module can depend only on another FunctionalScript module.
  • It also has no standard library. Only a safe subset of standard JavaScript API can be used without referencing other modules.

Applications

FunctionalScript code can be used:

  • in any JavaScript/TypeScript application,
  • as a JSON with expressions,
  • as a query language.

Sponsors

functionalscript's People

Contributors

dependabot[bot] avatar miyanni avatar sergey-shandar avatar trinidadec avatar vortexishere avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

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.