[ 
https://issues.apache.org/jira/browse/SYSTEMML-260?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Deron Eriksson resolved SYSTEMML-260.
-------------------------------------
    Resolution: Fixed

Fixed by [commit 
1b48ca0a91997f1efa72210dbb1d289359f043e6|https://github.com/apache/incubator-systemml/commit/1b48ca0a91997f1efa72210dbb1d289359f043e6]

> Can't specify a linefeed character when printing to console
> -----------------------------------------------------------
>
>                 Key: SYSTEMML-260
>                 URL: https://issues.apache.org/jira/browse/SYSTEMML-260
>             Project: SystemML
>          Issue Type: Improvement
>          Components: APIs
>            Reporter: Deron Eriksson
>            Assignee: Niketan Pansare
>            Priority: Minor
>
> When trying to figure out DML and PyDML code, it is very useful to print 
> information to the console (using the print() function). Currently, it does 
> not appear possible to be able to output a linefeed character.
> For example, the following DML:
> {code}x=1
> y=2
> print('x:' + x + '\ny:' + y)
> print('x:' + x + '\\ny:' + y){code}
> produces:
> {code}x:1\ny:2
> x:1\\ny:2{code}
> This becomes more of an issue as the complexity of what is being looked at 
> increases. 
> For example, here a function returning a string displaying the values in a 
> matrix is called and the results are printed to the console.
> {code}matrixVals = function(matrix[double] mat) return (string str){
>       str = '';
>       for (i in 1:nrow(mat)) {
>               str = str + '| '
>               for (j in 1:ncol(mat)) {
>                       n = mat[i,j]
>                       str = str + as.scalar(n) + ' | '
>               }
>               str = str + '\n'
>       }
> }
> m = matrix("1 2 3 4 5 6 7 8 9 10 11 12", rows=4, cols=3)
> vals = matrixVals(m)
> print(vals){code}
> The printed string is:
> {code}| 1.0 | 2.0 | 3.0 | \n| 4.0 | 5.0 | 6.0 | \n| 7.0 | 8.0 | 9.0 | \n| 
> 10.0 | 11.0 | 12.0 | \n{code}
> Being able to output a linefeed character can assist DML/PyDML creators when 
> figuring out their scripts.
> Note: it's possible to output a linefeed by actually having a linefeed in the 
> string, but this produces code that is difficult to manage.
> {code}x=1
> y=2
> print('x:' + x + '
> y:' + y){code}
> produces:
> {code}x:1
> y:2{code}
> So, it would be nice to be able to recognize either \n or a double 
> backslashed n as a linefeed.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to