SALT, dfns and ]Defs
7 posts
• Page 1 of 1
SALT, dfns and ]Defs
I have a SALTed workspace that contains (only) dfns. They were created as one-liners but they now have two lines because SALT has added timestamps.
]Defs just lists names since the dfns are now multi-line.
I'm tempted to try to create my own variant of ]Defs but I am a Dyalog noob and there are already lots of things on my 'stuff to learn' list. What should I do?
]Defs just lists names since the dfns are now multi-line.
I'm tempted to try to create my own variant of ]Defs but I am a Dyalog noob and there are already lots of things on my 'stuff to learn' list. What should I do?
- romilly
- Posts: 6
- Joined: Tue May 03, 2016 9:51 am
Re: SALT, dfns and ]Defs
It may be possible for ]defs to spot a SALTed one-liner and display the original (desalinated) version.
Thanks - will investigate.
Thanks - will investigate.
- JohnS|Dyalog
Re: SALT, dfns and ]Defs
pro-tem you could do
↑{3↓⊃,/' ⋄ '∘,¨⎕nr ⍵}¨↓⎕nl 3.2 4.2switching ↑ and ⊃ if ⎕ML>1
f00←{⍺+⍵}
f01←{⍺-⍵}
f02←{⍺×⍵}
f03←{⍺÷⍵}
↑{3↓⊃,/' ⋄ '∘,¨⎕NR ⍵}¨↓⎕NL 3.2 4.2
f00←{⍺+⍵}
f01←{⍺-⍵}
f02←{⍺×⍵}
f03←{⍺÷⍵}
⎕fx'f04←{⍺+⍵' '⍝' '}'
⎕fx'f05←{⍺-⍵' '⍝' '}'
⎕fx'f06←{⍺×⍵' '⍝' '}'
⎕fx'f07←{⍺÷⍵' '⍝' '}'
↑{3↓⊃,/' ⋄ '∘,¨⎕NR ⍵}¨↓⎕NL 3.2 4.2
f00←{⍺+⍵}
f01←{⍺-⍵}
f02←{⍺×⍵}
f03←{⍺÷⍵}
f04←{⍺+⍵ ⋄ ⍝ ⋄ }
f05←{⍺-⍵ ⋄ ⍝ ⋄ }
f06←{⍺×⍵ ⋄ ⍝ ⋄ }
f07←{⍺÷⍵ ⋄ ⍝ ⋄ }
-
Phil Last - Posts: 628
- Joined: Thu Jun 18, 2009 6:29 pm
- Location: Wessex
Re: SALT, dfns and ]Defs
Which reminds me of a drawback pointed out some years ago by Richard Nabavi regarding dfns that I challenged at the time but which obviously doesn't trouble Romily. Richard's point can be paraphrased as "dfns discourage documentation". You can't put a trailing comment on a one-line dfn because the closing brace becomes, or would become, a part of the comment.
Rather than adding dependencies to one function, a user command, to accommodate peculiarities in an almost unrelated piece of software, SALT, perhaps the latter could itself be changed to cause less fundamental change to its client functions by not converting one-liners to multi-liners and instead adding a quoted comment after the left identity.
f00←{⍺+⍵ ⍝ this cannot be fixed }My proposed remedy then was
f00←{⍺+⍵ ⊣ '⍝ whereas this can' }[Actually not my idea. I believe I got it straight from KEI's "A Dictionary of APL"]
Rather than adding dependencies to one function, a user command, to accommodate peculiarities in an almost unrelated piece of software, SALT, perhaps the latter could itself be changed to cause less fundamental change to its client functions by not converting one-liners to multi-liners and instead adding a quoted comment after the left identity.
-
Phil Last - Posts: 628
- Joined: Thu Jun 18, 2009 6:29 pm
- Location: Wessex
Re: SALT, dfns and ]Defs
First, thanks for the workaround, Phil, which works a treat.
I had not encountered the issue with comments in one-liners because I added comments after the dfns were salted. My workflow will now be:
1) create/test the dfn
2) salt it
3) add the comment at the end of the first line
That's ok but it would be nicer to be able to write the comment when I create the dfn.
I had not encountered the issue with comments in one-liners because I added comments after the dfns were salted. My workflow will now be:
1) create/test the dfn
2) salt it
3) add the comment at the end of the first line
That's ok but it would be nicer to be able to write the comment when I create the dfn.
- romilly
- Posts: 6
- Joined: Tue May 03, 2016 9:51 am
Re: SALT, dfns and ]Defs
Incidentally, changing
↑{3↓⊃,/' ⋄ '∘,¨⎕NR ⍵}¨↓⎕NL 3.2 4.2into
{⎕←3↓⊃,/' ⋄ '∘,¨⎕NR ⍵}¨↓⎕NL 3.2 4.2will overcome problems encountered if any of your dfns get too large to string out across the screen. By displaying each in turn only the culprits will wrap.
-
Phil Last - Posts: 628
- Joined: Thu Jun 18, 2009 6:29 pm
- Location: Wessex
Re: SALT, dfns and ]Defs
I have modified ]defs to ignore SALT tags. Will appear in the next Beta.
- DanB|Dyalog
7 posts
• Page 1 of 1
Return to Functional Programming
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group