Algebraic data types: Difference between revisions
Content deleted Content added
m →{{header|Bracmat}}: removed some newlines |
|||
Line 7: | Line 7: | ||
=={{header|Bracmat}}== |
=={{header|Bracmat}}== |
||
<lang bracmat> |
<lang bracmat> ( balance |
||
( balance |
|||
= a x b y c zd |
= a x b y c zd |
||
. !arg |
. !arg |
||
Line 54: | Line 53: | ||
| insert$!arg |
| insert$!arg |
||
) |
) |
||
⚫ | |||
; |
|||
⚫ | |||
Test: |
Test: |
||
<lang bracmat> |
<lang bracmat> ( it allows for terse code which is easy to read |
||
( it allows for terse code which is easy to read |
|||
, and can represent the algorithm directly |
, and can represent the algorithm directly |
||
. |
. |
||
Line 66: | Line 63: | ||
& insertMany$(!values.):?tree |
& insertMany$(!values.):?tree |
||
& out$!tree |
& out$!tree |
||
& done; |
& done;</lang> |
||
</lang> |
|||
Output: |
Output: |
||
<lang bracmat> |
<lang bracmat> B |
||
B |
|||
. ( B |
. ( B |
||
. (R.(B.,,),algorithm,(B.,allows,)) |
. (R.(B.,,),algorithm,(B.,allows,)) |
||
Line 90: | Line 85: | ||
, (R.(B.,the,),to,(B.,which,)) |
, (R.(B.,the,),to,(B.,which,)) |
||
) |
) |
||
) |
)</lang> |
||
</lang> |
|||
=={{header|C}}== |
=={{header|C}}== |