Page 1 of 1

Fix Multiple Text Files to a Workspace

Posted: Thu Dec 09, 2021 12:40 am
by REMINGTON30
If several functions are stored as text files, is there a way to fix all of them to the workspace in one command? I have been fixing files to the workspace one at a time using the editor, i.e., edit text file then fix. However, there should be a way to fix several text files to the workspace in one command. For example consider three files: func1.dyalog func2.dyalog func3dyalog .

Thanks for your help with this.

Re: Fix Multiple Text Files to a Workspace

Posted: Thu Dec 09, 2021 1:34 am
by petermsiegel
⍝ This is one way...
⎕← 2 ⎕FIX¨(⊂'file://'),¨'func1.dyalog' 'func2.dyalog' 'func3.dyalog'

Re: Fix Multiple Text Files to a Workspace

Posted: Thu Dec 09, 2021 1:54 pm
by Vince|Dyalog
Hi,

If you are using 18.0 or beta 18.2, you can use Link.

There is documentation here:
https://dyalog.github.io/link/3.0/

With Link, I can create a link between # and a directory on disk with:

      ]link.create # C:\mydir


This brings in APL functions in .dyalog or .aplf files into # in the current workspace.

Regards,

Vince

Re: Fix Multiple Text Files to a Workspace

Posted: Thu Dec 09, 2021 7:00 pm
by REMINGTON30
Peter and Vince: Thank you for the responses. I am using version 18.0 and will review the documentation that you mention.

Re: Fix Multiple Text Files to a Workspace

Posted: Thu Dec 09, 2021 11:12 pm
by petermsiegel
Or, as a utility:

Code: Select all

Load←{                             
     fis←(⊂'file://'),¨⍵,¨⊂'.dyalog'
     2 ⎕FIX¨fis                     
 }                                 
 

Re: Fix Multiple Text Files to a Workspace

Posted: Sat Dec 11, 2021 10:53 pm
by Phil Last
petermsiegel wrote:
      Load←{                             
fis←(⊂'file://'),¨⍵,¨⊂'.dyalog'
2 ⎕FIX¨fis
}
You could probably use a "⊆" (enclose if simple) in there somewhere so it can be used with a single name as a string.

Re: Fix Multiple Text Files to a Workspace

Posted: Sun Dec 12, 2021 8:24 pm
by petermsiegel
Duh. How easy it is (for me) to forget the newer primitives.

Thanks!

Re: Fix Multiple Text Files to a Workspace

Posted: Mon Dec 13, 2021 6:50 pm
by REMINGTON30
Thanks to all for the very useful comments. The methods mentioned will make assembling a workspace from functions stored as text files much easier. No doubt it will help others as well.

The method using ]link.create # will have to wait until I have time to review the documentation.

Alan
Belgrade, Montana, USA

Re: Fix Multiple Text Files to a Workspace

Posted: Mon Dec 20, 2021 4:11 pm
by paulmansour
REMINGTON30 wrote:Alan
Belgrade, Montana, USA


Wow, another APLer in Montana! Who knew? I'm in Bozeman. Having an APL moot (informal gathering for fellowship, coding, eating and drinking, etc.) in early January with some out-of-town APLers. Send me an email to paul@carlislegroup.com if you would like to stop in for an afternoon/evening.

If weather permits, we will be hitting Logan for an afternoon of outdoor activity at the
      (⌈/-⌊/)
and then Land of Magic or Sir Scotts.