Skip to content

Commit

Permalink
Update the Logtalk tutorial notebook to use the new table cell magic
Browse files Browse the repository at this point in the history
  • Loading branch information
pmoura committed Dec 3, 2022
1 parent 759594b commit bd28248
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 114 deletions.
7 changes: 4 additions & 3 deletions logtalk_kernel/logtalk_server/jupyter_request_handling.lgt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
:- public(loop/3). % loop(+ContIn, +Stack, -ContOut)

:- uses(term_io, [format_to_atom/3, write_term_to_atom/3]).
:- uses(user, [atomic_list_concat/2]).

:- uses(jupyter_logging, [create_log_file/1, log/1, log/2]).
:- uses(jupyter_jsonrpc, [send_success_reply/2, send_error_reply/3, next_jsonrpc_message/1, parse_json_terms_request/3]).
:- uses(jupyter_term_handling, [handle_term/6, term_response/1]).
Expand Down Expand Up @@ -272,15 +274,14 @@
; Goal = Goal0
),
!,
user::atomic_list_concat(['print_table(', Goal, ').'], Rest).

atomic_list_concat(['print_table(', Goal, ').'], Rest).
goal_cell_magic(Code, Rest) :-
atom_concat('@tree\n', Term0, Code),
( sub_atom(Term0, _, 1, 0, '.') ->
sub_atom(Term0, 0, _, 1, Term)
; Term = Term0
),
!,
user::atomic_list_concat(['show_term(', Term, ').'], Rest).
atomic_list_concat(['show_term(', Term, ').'], Rest).

:- end_object.
Loading

0 comments on commit bd28248

Please sign in to comment.