[Radiance-general] Research tools: who what which how?

Tim Perry tim.v2.0 at gmail.com
Wed Apr 13 11:12:16 PDT 2016


In alphabetical order: bash, c, c++, clojure, haskell, java, R.

Haskell is often the quickest to write and and runs as compiled code --
comparable to intelligently written but un-optimized c, c++ and Java. The
learning curve is painfully steep.

On Wed, Apr 13, 2016 at 10:01 AM, Christopher Rush <
Christopher.Rush at arup.com> wrote:

> For a trivial example of transposing a matrix tab delimited data file...
> which of these is most easily understood, reproducible, and fastest. Also
> note, I couldn't find a working Ruby example...
>
>
> perl -anF'\t|\n' -e'$n=@F-1if!$n;for(0..$n){push@{$$m[$_]},$F[$_]}
> END{print map{join"\t",@$_,"\n"}@$m}'
> ^^ this takes a quarter of a second on 148K file, and doesn't look
> particularly clean but I could probably figure it out by researching the
> documentation
>
> python -c "import sys; print('\n'.join(' '.join(c) for c in
> zip(*(l.split() for l in sys.stdin.readlines() if l.strip()))))"
> ^^ this takes half a second on 148K file but looks a bit baffling to me
>
> awk '{for (f=1;f<=NF;f++) col[f] = col[f]":"$f} END {for (f=1;f<=NF;f++)
> print col[f]}' | tr ':' ' '
> ^^ this takes 2 seconds on 148K file which isn't very good, but probably
> the easiest to interpret by eye, in my opinion
>
> ruby -e 'puts readlines.map(&:split).transpose.map{|x|x*" "}'
> ^^ I couldn't make this or any other Ruby examples I found online work,
> which might mean I have a basic misunderstand of how to type this in a
> single line workflow on the terminal. And all the examples I could find
> look like a black box to me because apparently there are functions built in
> to do this task.
>
> echo '' >tmp1;  cat m.txt |while read l ; do paste tmp1 <(echo $l | tr -s
> ' ' \\n)>tmp2; cp tmp2 tmp1; done
> ^^ this series of commands is basically disqualified because it takes far
> too long
>
>
> Taken from these threads:
> http://stackoverflow.com/questions/1729824/transpose-a-file-in-bash
> http://stackoverflow.com/questions/3249508/transpose-in-perl
>
> ____________________________________________________________
> Electronic mail messages entering and leaving Arup  business
> systems are scanned for acceptability of content and viruses
>
>
> _______________________________________________
> Radiance-general mailing list
> Radiance-general at radiance-online.org
> http://www.radiance-online.org/mailman/listinfo/radiance-general
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.radiance-online.org/pipermail/radiance-general/attachments/20160413/4f48a1bc/attachment.html>


More information about the Radiance-general mailing list