Skip to content

Commit 17360f4

Browse files
martanitdwijm12
authored andcommitted
Fix defn error when modifying a tradfn.
1 parent 6b41e4f commit 17360f4

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

dyalog_kernel/kernel.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,17 @@ def do_execute(self, code, silent, store_history=True, user_expressions=None,
354354
self.out_error(
355355
'JUPYTER NOTEBOOK: UNDEFINED ARGUMENT TO %suspend, USE EITHER on OR off')
356356
lines = lines[1:]
357+
elif re.match('^\\s*∇', lines[0]):
358+
if not re.match('\\s*∇$', lines[-1]):
359+
self.out_error('DEFN ERROR: Missing closing ∇')
360+
else:
361+
if len(lines)==1:
362+
self.out_error('DEFN ERROR')
363+
else:
364+
lines[0] = re.sub('^\\s*∇', '', lines[0])
365+
lines = lines[:-1]
366+
self.define_function(lines)
367+
lines = []
357368
elif lines[0].lower() == ']dinput':
358369
lines = lines[1:]
359370
try:

0 commit comments

Comments
 (0)