Skip to content

Commit

Permalink
Focusing on what's working
Browse files Browse the repository at this point in the history
  • Loading branch information
ashton314 committed Oct 1, 2024
1 parent c4afa8a commit a93e40e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
4 changes: 2 additions & 2 deletions main.rhm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export:
dyn_with_infix as with

meta:
// Matches syntax annotates with the `Dyn` annotation
syntax_class DynStx
| '$(x :: Term)': match_when:
def maybe_key = statinfo_meta.lookup(x, statinfo_meta.dot_provider_key)
Expand Down Expand Up @@ -45,7 +46,6 @@ expr.macro 'dyn_seq($expr)':
expr.macro 'maybe_dyn_block $thing:
$block':
def thing = statinfo_meta.lookup(thing, statinfo_meta.dot_provider_key)
// FIXME: this is a dumpy check
if thing && Syntax.to_source_string(thing) == "dyn_dot_provider"
| 'block:
use_dynamic
Expand Down Expand Up @@ -102,7 +102,7 @@ repet.macro '$func dyn_app ($(args :: repet_meta.Parsed), ...)':
$repet_temps: $repet_exprs :~ PairList
...
$func_expr dyn_app ($all_temps, ...),
2, // can hardcode I think... we check that the args depth is 1 above.
2, // can hardcode I think... we check that the args depth is 1 above
$max_depth,
$si,
#false)')
Expand Down
34 changes: 17 additions & 17 deletions tests/general.rhm
Original file line number Diff line number Diff line change
Expand Up @@ -141,23 +141,23 @@ check_dyn:
// bar: [2, 4, 8]
// top_foo(foo, bar)

check_dyn:
block:
fun foo(x :: Dyn) :: Dyn:
x + 1

fun bar(x, y):
x + 2 * y

fun baz(x, y, z):
x + z * y

def [xs, ...] = [1, 2, 3]
def [ys, ...] = [2, 4, 6]
[foo(xs), ...]
[bar(xs, ys), ...]
[bar(1, xs), ...]
[baz(1, ys, 3), ...]
// check_dyn:
// block:
// fun foo(x :: Dyn) :: Dyn:
// x + 1

// fun bar(x, y):
// x + 2 * y

// fun baz(x, y, z):
// x + z * y

// def [xs, ...] = [1, 2, 3]
// def [ys, ...] = [2, 4, 6]
// [foo(xs), ...]
// [bar(xs, ys), ...]
// [bar(1, xs), ...]
// [baz(1, ys, 3), ...]

// FIXME: this isn't working right now
// def [[zs, ...], ...] = [[1, 2, 3], [4, 5]]
Expand Down
20 changes: 10 additions & 10 deletions tests/repet_test.rhm
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ fun foo(x):
fun bar(x, y):
x + 2 * y

def [xs, ...] = [1, 2, 3]
def [ys, ...] = [2, 4, 6]
[foo(xs), ...]
// [bar(xs, ys), ...]
// [bar(1, ys), ...]
// def [xs, ...] = [1, 2, 3]
// def [ys, ...] = [2, 4, 6]
// [foo(xs), ...]
// // [bar(xs, ys), ...]
// // [bar(1, ys), ...]


fun
| max([n]): n
| max([n, ns, ...]):
let m = max([ns, ...])
if m > n | m | n
// fun
// | max([n]): n
// | max([n, ns, ...]):
// let m = max([ns, ...])
// if m > n | m | n

0 comments on commit a93e40e

Please sign in to comment.