- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
scala in bash
Thu, 2011-08-11, 20:15
I'm proud of this one so I will take the unusual step of actually
telling someone about code I've written.
https://github.com/paulp/scalabash
Example from README:
# The % is a marker for each incoming argument
bash> printf "1\n2\n3\n" | foreach-stdin echo a b % d e
a b 1 d e
a b 2 d e
a b 3 d e
If you look under the hood there is some pretty sick stuff going on. I
think it can be simplified a bit, but the key idea is the implementation
of closure-like things with eval. For the most part the ideas are other
peoples', but I couldn't find anyone who had packaged everything up such
that I could run a pipeline through foreach (or we could call it map,
it's not like there's an amazing difference in bash) like the gods intended.
Mon, 2011-08-15, 16:17
#2
Re: scala in bash
On 8/14/11 10:26 PM, Stefan Wagner wrote:
> looks more simple
Can't tell if you're joking. The goal wasn't to write software which
produces that exact output. I know that "a b 1 d e" comes up a lot, but
sometimes we have to do other things too.
Note to self: include fancier examples of what one might do with
anonymous functions.
Tue, 2011-08-16, 01:17
#3
Re: scala in bash
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Am 15.08.2011 17:11, schrieb Paul Phillips:
> On 8/14/11 10:26 PM, Stefan Wagner wrote:
>> looks more simple
>
> Can't tell if you're joking. The goal wasn't to write software which
> produces that exact output. I know that "a b 1 d e" comes up a lot, but
> sometimes we have to do other things too.
I'm always joking, and never.
I think to show the usefulness of your software, it should have one or
more examples, which are harder to do without it.
So I allowed myself to show you, that that example isn't so strong.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Am 11.08.2011 21:15, schrieb Paul Phillips:
> a b 1 d e
Pure bash:
echo -e "a b "{1..3}" d e\n"
a b 1 d e
a b 2 d e
a b 3 d e
looks more simple