bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-apl] Submission for GNU APL Bits_and_Pieces directory


From: alexweiner
Subject: [Bug-apl] Submission for GNU APL Bits_and_Pieces directory
Date: Sat, 27 Jun 2015 14:26:21 -0700
User-agent: Workspace Webmail 5.14.4

Hi Bug-apl,
I am soliciting feedback (as per the process) of the attached APL code that will take a file  that has a layout of two columns (space separator) and return a matrix.

-Alex
⍝
⍝ Author:      Alex Weiner
⍝ Date:        June 27, 2015
⍝ Copyright:   Copyright (C) 2015 by AlexWeiner
⍝ License:     LGPL see http://www.gnu.org/licenses/gpl-3.0.en.html
⍝ email:       address@hidden
⍝ Portability: L3
⍝
⍝ Purpose:
⍝ Read in a text file that space seperated records and parse it into a n×m size matrix
⍝ only supports two columns right now
⍝ Description:
⍝ Matrix←ReadTableData 'name of the file'
⍝
)COPY 5 FILE_IO.apl
filedata←{FIO∆read_file ⍵} 
lineends←{⊃⍵⊂⍨~⎕av[⎕io+10]=⍵}
mat←{lineends filedata ⍵}  
rows←{1↑⍴ ⍵} 
table←{((rows ⍵),2)⍴(,~' '=⍵)⊂,⍵}
ReadTableData←{table mat ⍵}
]NEXTFILE 
⍝
⍝ EOF 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]