Skip to content

Commit

Permalink
fix array initialiser
Browse files Browse the repository at this point in the history
  • Loading branch information
haldai committed Oct 29, 2019
1 parent d06ecc4 commit fbbc174
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion c/jurassic.c
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,8 @@ jl_expr_t *compound_to_jl_expr(term_t expr) {
if ( strcmp(fname, "=") == 0 ||
strcmp(fname, "call") == 0 ||
strcmp(fname, "kw") == 0 ||
strcmp(fname, "...") == 0) {
strcmp(fname, "...") == 0 ||
strcmp(fname, "curly") == 0) {
/* for these meta predicates, no need to add "call" as Expr.head */
#ifdef JURASSIC_DEBUG
printf(" Functor: %s/%lu.\n", fname, arity);
Expand Down
8 changes: 4 additions & 4 deletions jurassic.pl
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@
).
expand_array_init(Term, Term).

init_array(In, cmd(Str)) :-
init_array(In, Out) :-
compound_name_arguments(In, array, [Type, Init|Size]),
length(Size, Dim), list_tuple(Size, Size_Tuple),
swritef(Str, 'Array{%w, %w}(%w, %w)', [Type, Dim, Init, Size_Tuple]).
length(Size, Dim),
Out =.. [call, curly('Array', Type, Dim), Init|Size].

contains_array(Term) :-
compound(Term),
Expand Down Expand Up @@ -165,7 +165,7 @@
).

%% Turn list to tuple
list_tuple([A], (A)).
list_tuple([A], (A)).
list_tuple([A,B|L], (A,R)) :-
list_tuple([B|L], R).

Expand Down

0 comments on commit fbbc174

Please sign in to comment.