Skip to content

Instantly share code, notes, and snippets.

@ingydotnet
Last active December 27, 2015 23:39
Show Gist options
  • Select an option

  • Save ingydotnet/7406935 to your computer and use it in GitHub Desktop.

Select an option

Save ingydotnet/7406935 to your computer and use it in GitHub Desktop.
# Snippet from https://github.com/ingydotnet/testml-tml/blob/master/function.tml
test1 = (f, c, t) {
List(f, '->', c).Join == t
t.Strip(f).Strip('->') == c
t.Strip('->') == List(f, c).Join
}
test1.Type == 'Func'
Label = '$BlockLabel'
test1(*fruit, *color, *thing)
# In quisp:
(test1 = (
&[f c t]
((Join (List f '->' c)) == t)
((Strip (Strip t f) '->') == c)
((Strip t '->') == (Join List(f c)))
)
)
((Type test1) == Func)
(Label = '$BlockLabel')
(** [fruit color thing] (test1 *fruit *color *thing))
---
- - test1
- =
- - '&'
- - Array
- f
- c
- t
- - Join
- List
- f
- ->
- c
- ==
- t
- - - Strip
- - Strip
- t
- f
- ->
- ==
- c
- - - Strip
- t
- ->
- ==
- - Join
- - List
- f
- c
- - - Type
- test1
- ==
- Func
- - Label
- =
- $BlockLabel
- - '**'
- - Array
- fruit
- color
- thing
- - test1
- '*fruit'
- '*color'
- '*thing'
---
[
[test1, =, ['&', [Array, f, c, t], [
[[Join, [List, f, ->, c]], ==, t],
[[Strip, [Strip, t, f], ->], ==, c],
[[Strip, t, ->], ==, [Join, [List, f, c]]],
]]],
[[Type, test1], ==, Func],
[Label, =, $BlockLabel],
['**', [Array, fruit, color, thing],
[test1, '*fruit', '*color', '*thing']
]
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment