Giter Club home page Giter Club logo

amber's People

Contributors

acs2 avatar nineties avatar piethut 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

amber's Issues

OR-pattern

Enable use of OR-pattern.

f(Foo{x, } or Bar{, x}): x

f(\Foo{1, 2}) # => 1
f(\Bar{1, 2}) # => 2

[Specification] List vs. Array

What is the best data type for the syntax [a,b,c,...]?
[a,b,c,...] is the most simple expression to represent a sequence. This means that the internal
representation for the sequence must be efficient for most common usages of sequences.

[Core] Memory efficient implementation for short arrays.

I am considering an improvement on the internal representation of arrays.

  1. For the first time we create an array, allocate one continuous memory space for it.

    | header  | obj0 | obj1 | ... | obj n-1 |
    
  2. When it is extended and its length becomes bigger than some threshold, allocate another chunk, change the array to dynamically allocated array and truncate area which is no longer required.

    |header|length|capa|pointer|    <-- truncate
                            |
                            +-->| obj0 | obj1 | ... | obj n-1 |
    

The truncation causes fragmentation of heap area, but Amber VM's Copying-GC will resolve it.

predicate "defined"

Implement predicate named "defined":

defined(f, a_1, ..., a_n) = true (iff `f' is defined for arguments a_1, ..., a_n)

[Syntax] nospace option

Distinguish f(a,b,c), f[a,b,c] and f{a,b,c} from f (a,b,c), f[a,b,c] and f {a,b,c}.
We need nospace option for defining syntaxes. See also #29.

[Syntax] Parentheses-less multiple assignment.

When a function f returns multiple values as a tuple, we can use pattern matching assignment to pick them up like

(a, b) = f(...)

I think it would be nicer if we can write it like:

a, b = f(...)

There are three possibilities.

  1. Do not provide this syntax as a standard.
  2. Add parentheses-less tuple syntax.
  3. Add special syntax for multiple assignment.

Survey use case of parentheses-less tuple syntax in other languages like Python.
When there are no significant use of it besides multiple assignment, I think it is better
to choice 2.

See also #29.

Assignment to interior parameters

Enable to assign a value to an interior parameter like:

f(Foo{x, Bar{y}}): {
x = 1
y = 2
}

Note: This assignment must not change given parameter.

e: \Foo{0, Bar{0}}
f(e)
puts(e) # => Foo{0, Bar{0}} (not Foo{1, Bar{2}})

Truth values

Currently a symbol "false" is treated as falsehood and every other value is treated as truth.

There should be other falsehoods?

  • an integer 0
  • empty list []
  • a symbol "nil"
  • empty string ""
    etc.

Rethink default syntax of Amber

  • blocks
    { }, do end, indentation-based or something else.
  • application of functions
    f(a,b,c) v.s. f a b c
  • nodes
    Head{a, b, c} or Head a b c

[Core] Replace lists to arrays.

I use a list for a default data type for sequences in the internal implementation of Amber. But lists are not memory efficient (three words are required per one element).

[Syntax] Parentheses-less function call.

Should Amber support the syntax of parentheses-less function call like Ruby?
I think it would be better to support to make new DSLs easier.

Now, I have one thing to think about tuples and lists.
When someone want to print out a tuple (a,b,c), he may write it as print (a, b, c).
But this is confusable with print(a, b, c), a function call with three arguments a, b and c. Lists has the same problem.
In case of Ruby, there are no tuples and for arrays f[a,b,c] and f [a,b,c] have different meaning.

Are there any other problems with this syntax?

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.