Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions code/common/anymaputils.q

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lots of camelCase here, please remove

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.anymap.writeToAnyMap:{[data;filePath] (hsym filePath) 1: data; :(::)}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

most data writing functions in q have filepath as first param & data as second (e.g. set, upsert etc.). Seems unintuitive to have this the other way round.

.anymap.deriveAnymapFiles:{[filePath] strPath: string[filePath]; `$(strPath;strPath,"#";strPath,"##")}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.anymap.deriveAnymapFiles:{[filePath] strPath: string[filePath]; `$(strPath;strPath,"#";strPath,"##")}
.anymap.deriveAnymapFiles:{[filePath] `$string[filePath],/:("";"#";"##")}

think something like this should work the same

.anymap.util.copyAnyMap:{[fromFilePath; destFilePath] fromFilePaths:.anymap.deriveAnymapFiles[fromFilePath]; system (("cp "," " sv string fromFilePaths), " ", string destFilePath)}
.anymap.util.removeAnyMap:{[filePath] filePaths:.anymap.deriveAnymapFiles[filePath]; system ("rm "," " sv string filePaths)}
.anymap.util.moveAnyMap:{[fromFilePath; destFilePath] fromFilePaths:.anymap.deriveAnymapFiles[fromFilePath]; system (("mv "," " sv string fromFilePaths), " ", string destFilePath)}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these copy/remove/move functions rely on system commands and will only work on Linux. Should use the functions in .os namespace of torq so that they work cross-platform.