News for hackers. Stuff that matters.
Re:Arturo Programming Language by luuuzeta on Sunday October 16, 2022 @08:24PM (#33228546)
Interesting to see another language that uses the `loop` keyword for C-based `for` loops. The only other I know of is Raku[0].

    loop(my $i; $i < 10; $i) {
        say $i
    }

    loop {
        # do something infinitely 
    }
[0]: https://docs.raku.org/syntax/loop
Re:Arturo Programming Language by manbart on Sunday October 16, 2022 @08:55PM (#33228712)
Re:Arturo Programming Language by akritid on Sunday October 16, 2022 @09:17PM (#33228854)
Re:Arturo Programming Language by arturo-lang on Monday October 17, 2022 @07:34AM (#33232159)
Well, why not?! Since, after all, we all know them as "loops" ;-)
Re:Arturo Programming Language by draegtun on Monday October 17, 2022 @09:36AM (#33233251)
Arturo was influenced by Rebol which comes with LOOP - http://www.rebol.com/r3/docs/functions/loop.html

However there are some differences...

  loop 10 [
      print "hello"   ;; prints "hello" 10 times
  ]

  repeat n 10 [
      print n         ;; prints 1 to 10
  ]

  forever [
     print "hello"    ;; print "hello" forever!
  ]
Re:Arturo Programming Language by arturo-lang on Monday October 17, 2022 @12:08PM (#33235569)
Arturo has indeed been influenced by Rebol (and many other languages, to be honest).

As for looping...

    loop 1..10 'x -> print x                               ; prints 1 to 10

    loop.with:'i ["one" "two"] 'x -> print [i "=>" x]      ; 0 => one, 1 => two

    do.times: 10 -> print "hello"                          ; print "hello" 10 times

    loop.forever 1..10 'x -> print x                       ; prints 1 to 10, forever

    loop 1..10 [x y]-> print [x y]                         ; print 0 1, 2 3, 4 5,...
The same works for pretty much every function in the Iterators module: map, select, filter, etc :)

https://arturo-lang.io/documentation/library/iterators/