Fix Multiple Text Files to a Workspace

Learning APL or new to Dyalog? Ask "silly" questions here, without fear...
Post Reply
REMINGTON30
Posts: 22
Joined: Fri Aug 11, 2017 2:17 pm

Fix Multiple Text Files to a Workspace

Post 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.
petermsiegel
Posts: 159
Joined: Thu Nov 11, 2010 11:04 pm

Re: Fix Multiple Text Files to a Workspace

Post by petermsiegel »

⍝ This is one way...
⎕← 2 ⎕FIX¨(⊂'file://'),¨'func1.dyalog' 'func2.dyalog' 'func3.dyalog'
Vince|Dyalog
Posts: 439
Joined: Wed Oct 01, 2008 9:39 am

Re: Fix Multiple Text Files to a Workspace

Post 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
REMINGTON30
Posts: 22
Joined: Fri Aug 11, 2017 2:17 pm

Re: Fix Multiple Text Files to a Workspace

Post by REMINGTON30 »

Peter and Vince: Thank you for the responses. I am using version 18.0 and will review the documentation that you mention.
petermsiegel
Posts: 159
Joined: Thu Nov 11, 2010 11:04 pm

Re: Fix Multiple Text Files to a Workspace

Post by petermsiegel »

Or, as a utility:

Code: Select all

Load←{                             
     fis←(⊂'file://'),¨⍵,¨⊂'.dyalog'
     2 ⎕FIX¨fis                     
 }                                 
 
User avatar
Phil Last
Posts: 628
Joined: Thu Jun 18, 2009 6:29 pm
Location: Wessex

Re: Fix Multiple Text Files to a Workspace

Post 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.
petermsiegel
Posts: 159
Joined: Thu Nov 11, 2010 11:04 pm

Re: Fix Multiple Text Files to a Workspace

Post by petermsiegel »

Duh. How easy it is (for me) to forget the newer primitives.

Thanks!
Last edited by petermsiegel on Tue Dec 14, 2021 5:09 am, edited 1 time in total.
REMINGTON30
Posts: 22
Joined: Fri Aug 11, 2017 2:17 pm

Re: Fix Multiple Text Files to a Workspace

Post 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
paulmansour
Posts: 431
Joined: Fri Oct 03, 2008 4:14 pm

Re: Fix Multiple Text Files to a Workspace

Post 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.
Post Reply