KoryNunn / presh

An immutable interpreted expression language.
MIT License
6 stars 2 forks source link

Creating a fully fledged language out of Presh #8

Closed markwylde closed 2 months ago

markwylde commented 5 years ago

If we were to go about creating a language out of Presh, it could look something like this:

joinName(firstName lastName) {
  firstName + ' ' + lastName
}

fastn('div'
  fastn('span' 'hello')
  fastn('span' fastn.binding('firstName' 'lastName' joinName))
)

|> (updateState){
  updateState()({
    firstName: 'Mark',
    lastName: 'Smith',
    country: 'France'
  })

  updateState('firstName')('Alex')

  serverNameChange
  <| updateState('firstName')
}

|> (render){
  window.onLoad((){
    document.body.appendChild(render())
  })
}