Skip to content

Instantly share code, notes, and snippets.

@dahlia
Created June 17, 2011 04:50
Show Gist options
  • Save dahlia/1030889 to your computer and use it in GitHub Desktop.
Save dahlia/1030889 to your computer and use it in GitHub Desktop.
<person> := class (name: <string>, email: url.<email>, url: url.<url>,
gender: <gender>, dob: datetime.<date>) {
name := name
email := email
url := url
gender := gender
dob := dob
first-last := property {
if (name.contains?(',')) {
name.split(',', 1).map(:trim)
} else {
name.split()
}
}
first-name := property {
first-last[0]
}
last-name := property {
first-last[1]
}
}
>>> l := [1, 2, 3, 4, 5, 6]
[1, 2, 3, 4, 5, 6]
>>> l.first
1
>>> l.rest
[2, 3, 4, 5, 6]
>>> l.+class
<list>
>>> l.rest.+class
<list>.<partial-sequence>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment