Created
April 6, 2019 00:20
-
-
Save Ke-/06fd5279b50dfbb9cd59cf6bf94e65ee to your computer and use it in GitHub Desktop.
Tab delimited data to array of Lasso maps.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| define tab_to_maps(p::staticarray) => tab_to_map(: #p ) | |
| define tab_to_maps(p::string, ...) => { | |
| local( | |
| delimiter = '\t', | |
| lines = params->size > 1 ? params | #p->split('\n'), | |
| cols = #lines->first->split(#delimiter), | |
| out = array | |
| ) | |
| with line in #lines | |
| skip 1 | |
| where #line | |
| let row = #line->split(#delimiter) | |
| let m = map | |
| do protect => { | |
| handle_error => { | |
| debug(error_msg = #row) | |
| } | |
| local(i) = 1 | |
| #cols->foreach => { | |
| #m->insert( | |
| #1 = #row->get(#i++) | |
| ) | |
| } | |
| #out->insert(#m) | |
| } | |
| return #out | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment