Fix Multiple Text Files to a Workspace

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

Fix Multiple Text Files to a Workspace

Postby REMINGTON30 on Thu Dec 09, 2021 12:40 am

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

Re: Fix Multiple Text Files to a Workspace

Postby petermsiegel on Thu Dec 09, 2021 1:34 am

⍝ This is one way...
⎕← 2 ⎕FIX¨(⊂'file://'),¨'func1.dyalog' 'func2.dyalog' 'func3.dyalog'
petermsiegel
 
Posts: 104
Joined: Thu Nov 11, 2010 11:04 pm

Re: Fix Multiple Text Files to a Workspace

Postby Vince|Dyalog on Thu Dec 09, 2021 1:54 pm

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
Vince|Dyalog
 
Posts: 359
Joined: Wed Oct 01, 2008 9:39 am

Re: Fix Multiple Text Files to a Workspace

Postby REMINGTON30 on Thu Dec 09, 2021 7:00 pm

Peter and Vince: Thank you for the responses. I am using version 18.0 and will review the documentation that you mention.
REMINGTON30
 
Posts: 22
Joined: Fri Aug 11, 2017 2:17 pm

Re: Fix Multiple Text Files to a Workspace

Postby petermsiegel on Thu Dec 09, 2021 11:12 pm

Or, as a utility:
Code: Select all
Load←{                             
     fis←(⊂'file://'),¨⍵,¨⊂'.dyalog'
     2 ⎕FIX¨fis                     
 }                                 
 
petermsiegel
 
Posts: 104
Joined: Thu Nov 11, 2010 11:04 pm

Re: Fix Multiple Text Files to a Workspace

Postby Phil Last on Sat Dec 11, 2021 10:53 pm

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.
User avatar
Phil Last
 
Posts: 592
Joined: Thu Jun 18, 2009 6:29 pm

Re: Fix Multiple Text Files to a Workspace

Postby petermsiegel on Sun Dec 12, 2021 8:24 pm

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

Re: Fix Multiple Text Files to a Workspace

Postby REMINGTON30 on Mon Dec 13, 2021 6:50 pm

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

Re: Fix Multiple Text Files to a Workspace

Postby paulmansour on Mon Dec 20, 2021 4:11 pm

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


Return to New to Dyalog?

Who is online

Users browsing this forum: No registered users and 1 guest