Live data from Hacker News

Streem – a new programming language from Matz

github.com

111–120 of 199 posts

Re: Streem – a new programming language from Matz

#111

I am glad that someone is working on a new stream processing language, it is a very interesting paradigm. However I hope that they provide some very robust tools for controlling input splitting. As I have spent too much time fighting with awk and wishing it was more flexible(it is frustrating always having exactly two levels of splitting with only matchers on the first and only inverse splitting on the second). As is…

> However I hope that they provide some very robust tools for controlling input splitting Yes, splitting and combining. Looking at the code example, I feel like so much opportunity is just being squandered, where something like Rust's mapping constructs would feel so much better. Yours is definitely more in that vein, here's something a little closer: STDIN | /\w+/{|word| /house/ => "foo" /car/ => "bar" "literal" =>…

Personally I would go for something more like this:

    STDIN | /\w+/ | {|each match|
      /house/   => "foo"
      /car/     => "bar"
      "literal" => "baz"
      _         => "dib"
    }
Where "each x" in a parameter list wraps the body in a map and uses x as the loop variable, and "match" in a parameter list instructs that this is the parameter we are doing pattern matching on in the body (no need to name it).

I think this is a more flexible solution, and more modifiers than each could be introduced. For instance, sum of squares could be:

    seq(100) | {|each x| x * x} | {|reduce (x = 0, y)| x + y}

Re: Streem – a new programming language from Matz

#112
post #69

Earlier quoted context omitted.

Awesome ! Let's call it sed ! Reference: https://www.gnu.org/software/sed/manual/sed.html#Examples Sorry, I couldn't miss that one. :) Really, check the example. Sed is most powerful tool and can do astonishing work.

That manual is possibly the single most useful technical document that I have ever read. It has enabled me to write extremely powerful programs that no one I know can understand. It would however be nice to have a tool with similar power but simpler, more comprehensible syntax. One of the other commenters linked to an interesting document on sam, which has a better control flow but equally arcane syntax.

I think that stream-oriented languages are doomed to have an arcanic syntax.

Streams are a non-trivial construction, after all.

Re: Streem – a new programming language from Matz

#113
post #69

Earlier quoted context omitted.

Awesome ! Let's call it sed ! Reference: https://www.gnu.org/software/sed/manual/sed.html#Examples Sorry, I couldn't miss that one. :) Really, check the example. Sed is most powerful tool and can do astonishing work.

Everything you can do in sed you can do in perl, there's been sed-to-perl converters shipped with perl since the ur-times.

Yeah yeah, of course. The hacked syntax showed by GP made me really think of sed. :)

Re: Streem – a new programming language from Matz

#114
Can someone help explain what's going on here: \"([^\\\"]|\\.)\" [seen here in context](https://github.com/matz/streem/blob/master/src/lex.l#L49).

Now it seems to be finding literal strings (so "strings" e.t.c.). That would explain the literal double quotes on either side. so without that we get: ([^\\\"]|\\.) so zero or more repeating versions of [^\\\"]|\\.

What I don't understand is why there is the explicit or \\. construct there, as this seems unnecessary. Am I missing something? also, why does it seem that strings cannot have either literal \ or literal " in them?

Re: Streem – a new programming language from Matz

#115
post #69

Earlier quoted context omitted.

Awesome ! Let's call it sed ! Reference: https://www.gnu.org/software/sed/manual/sed.html#Examples Sorry, I couldn't miss that one. :) Really, check the example. Sed is most powerful tool and can do astonishing work.

That manual is possibly the single most useful technical document that I have ever read. It has enabled me to write extremely powerful programs that no one I know can understand. It would however be nice to have a tool with similar power but simpler, more comprehensible syntax. One of the other commenters linked to an interesting document on sam, which has a better control flow but equally arcane syntax.

I think I could argue that Perl is that tool. I'm not looking forward to people chiming in about the syntax that have little to no experience with it though.

Re: Streem – a new programming language from Matz

#117
post #26

Earlier quoted context omitted.

It's not any shorter. The extra check as to whether or not to print the line break cancels out the mod 15 check. In my opinion, it's cleaner to have three conditionals of the same type than two checking mods and a third checking the OR of the first two. Of course, it can be actually shorter with a goto.

Whether you print the number, Fizz, Buzz or FizzBuzz you are going output a line break, so I'm not sure what you would be checking for. Output \n unconditionally.

Then you call `printf` twice every loop instead of once. `printf` is buffered so you aren't making two system calls, but you are still making two function calls.

Re: Streem – a new programming language from Matz

#119
post #24

Earlier quoted context omitted.

[deleted]

noice, here's my version print("\n".join([("FIZZ"*(i%3==0)+"BUZZ"*(i%5==0)) or str(i) for i in range(1,101)]))

Starting now with this programming thing, right?

This is straight poser code -- inadvisable in any real life situation, and not that robust either.

Re: Streem – a new programming language from Matz

#120
post #93
post #88

Earlier quoted context omitted.

I prefer {|el| el + 5} more than { _ + 5 } the latter is too implicit for my taste, also I imagine it could become more confusing in a more complex context.

Personally I like it and find it clear. Compare: ary.map(_ * 2) ary.map(x => x * 2) "_" is perhaps an ugly choice of character (frankly I'm not sure why Scala is so obsessed with it, since it's used for so many featurse), but I think the semantics are sensible. Of course, in a more functional language you could perhaps just write ary.map(* 2)

Probably because underscore is often used by convention in forms and other typography to indicate "something goes here which is to be supplied." In that respect it's no different that Perl's $_ (actually it's the Exact same thing, as the $ in Perl just denotes a variable, so they are both the variable _), or Perl 6's "whatever" which is written as "*".
Post reply on HN