How to automatically ]display variables?

Learning APL or new to Dyalog? Ask "silly" questions here, without fear...

How to automatically ]display variables?

Postby alexeyv on Tue Nov 17, 2015 6:46 pm

Hi,

I've seen in the Dyalog APL screencast (Depth-first search in APL) that the entered variables to interpreter were presented automatically with ]display. How can I configure my interpreter to behave the same way, so I don't need to write ]display all the time?
alexeyv
 
Posts: 56
Joined: Tue Nov 17, 2015 4:18 pm

Re: How to automatically ]display variables?

Postby Phil Last on Tue Nov 17, 2015 7:03 pm

Try user command ]BOXING (which can be abbreviated to ]BOX

      ]?boxing
Command "output.Boxing". Syntax: 1 argument or less.
Accepts switches -chars= -fns= -style= -trains=
Switch 'chars' accepts only values "regular", "ascii"
Switch 'fns' accepts only values "off", "on"
Switch 'style' accepts only values "min", "mid", "max"
Switch 'trains' accepts only values "box", "tree", "parens"
Boxing of default nested output

Script location: C:\Program Files\Dyalog\Dyalog APL-64 14.0 Unicode\SALT\Spice\output

]?box
Command "output.Box". Syntax: 1 argument or less.
Accepts switches -chars= -fns= -style= -trains=
Switch 'chars' accepts only values "regular", "ascii"
Switch 'fns' accepts only values "off", "on"
Switch 'style' accepts only values "min", "mid", "max"
Switch 'trains' accepts only values "box", "tree", "parens"
Boxing of default nested output

Script location: C:\Program Files\Dyalog\Dyalog APL-64 14.0 Unicode\SALT\Spice\output
User avatar
Phil Last
 
Posts: 628
Joined: Thu Jun 18, 2009 6:29 pm
Location: Wessex

Re: How to automatically ]display variables?

Postby alexeyv on Wed Nov 18, 2015 9:27 pm

Awesome, thanks! Is where any way to set ']boxing on' as a default behavior for the interpreter?
alexeyv
 
Posts: 56
Joined: Tue Nov 17, 2015 4:18 pm

Re: How to automatically ]display variables?

Postby JohnS|Dyalog on Thu Nov 19, 2015 12:44 pm

If you're using Dyalog on a (Windows) PC, you can save the current state of ]boxing by selecting Session->Save from the menu bar. This state will then be in effect next time you start Dyalog.
JohnS|Dyalog
 

Re: How to automatically ]display variables?

Postby alexeyv on Fri Nov 20, 2015 6:52 pm

Thanks, I'm on OSX. I would like to have it as a default value for all my workspaces. Probably some magic option in .dyalog/dyalog.config ?
alexeyv
 
Posts: 56
Joined: Tue Nov 17, 2015 4:18 pm

Re: How to automatically ]display variables?

Postby Phil Last on Sun Nov 22, 2015 10:26 am

There's probably a more straightforward way that this but my invocation of Dyalog always loads the same ws and the ⎕LX sets various things for the session. You might not know that most if not all user commands can be run as:
      ⎕SE.UCMD 'string'
where string is exactly what you'd type after the square bracket ] in the session but with quotes doubled of course.

Personally I find there is a number of circumstances where I want to switch it off and as I have quite a long command to set it on I put it on a PFKey:
      boxing ON -style=max -trains=parens -fns=off -chars=ascii
that is set by the ⎕LX in my initial )LOAD.
User avatar
Phil Last
 
Posts: 628
Joined: Thu Jun 18, 2009 6:29 pm
Location: Wessex

Re: How to automatically ]display variables?

Postby DanB|Dyalog on Mon Nov 23, 2015 2:31 am

When APL starts it reloads the latest version of SALT and User Commands from disk (there is a copy in the session file under Windows but just to be sure...)
The last thing it does after reloading it is execute the user command ]usetup
This cmd allows you to customize your session before it starts.
You could use it to set up PFkeys of even set ]box on.
Have a look at ]??usetup for an example.
DanB|Dyalog
 

Re: How to automatically ]display variables?

Postby JohnS|Dyalog on Mon Nov 23, 2015 12:33 pm

A couple of ]boxing tips:

1. If you like to run with ]boxing on but occasionally want to see unboxed output, place a ⍕ (format) to the left of the line:
      ⍳⍳2     ⍝ with boxing on
┌───┬───┐
│1 1│1 2│
└───┴───┘
⍕ ⍳⍳2 ⍝ one-time unboxed output
1 1 1 2
2. Notice that the output from ]box ? is in a format suitable for typing over and re-submitting, in order to change preferences:
      ++++   ⍝ function train
┌─┬───────┐
│+│┌─┬─┬─┐│
│ ││+│+│+││
│ │└─┴─┴─┘│
└─┴───────┘
]box ?
]boxing ON -style=min -trains=box -fns=off -chars=regular
]boxing ON -style=min -trains=tree -fns=off -chars=regular
Was ON -style=min -trains=box -chars=regular -fns=off
++++ ⍝ function train
┌─┴─┐
+ ┌─┼─┐
+ + +
JohnS|Dyalog
 

Re: How to automatically ]display variables?

Postby alexeyv on Thu Nov 26, 2015 10:04 pm

Thanks for all answers! It still however looks a little 'hackish', or, in other words, too advanced for beginner user who just wants to have a more convenient output. Is where a reason why options like this could not be simple configuration options in the config file?
alexeyv
 
Posts: 56
Joined: Tue Nov 17, 2015 4:18 pm


Return to New to Dyalog?

Who is online

Users browsing this forum: No registered users and 1 guest