Hacker News new | ask | show | jobs
by singularity2001 1613 days ago
1. Match by type name:

Merge the concept of type and variable (name) in simple functions:

To assign a photo to a contact: contact.image = photo

Here both photo and contact act as matching types and as variable identifiers.

2. 'that' lambda filter

files that exist =>

files.each.filter(it.exist) or

files.each.filter(file=>{file.exist})

3. of keyword : reverse properties title of book => book.title

4. indexing with '#'

Colors = [red, green, blue] Color#1 is red

(zero based indexing can still be done via [] if desired

5. universal in-place assignment

Each operator automatically works with assignment: x ⊛= b is always a shorthand for x = x ⊛ b.

6. universal broadcasting

All functions are automatically broadcasting on lists and pair values:

square number := number * number square [1 2 3] == [1 4 9]

https://github.com/pannous/wasp/wiki/inventions