W has a settable max-limit. it’s around 10k for this release, i think.

It caps at 10,000 iterations at the moment, but it could be anything.

Appending to a pattern that changes lengths dynamically with a configurable cap?

I’m not sure I follow. Could you write an example script?

given L is weak for() and we have if/else, i’d say while() rounds out the basic set of conditionals. i can see cases where doing conditional pattern manipulation would make W useful.

Check again, L is now implemented with a pointer to I, so you can modify I meaningfully!

1 Like

Maybe I’m being nit-picky, but I’m going to play devil’s advocate. My stated intention is to ensure we’re not bloating the language.

As far as I can tell you can already do this W script:
W LT P.L 44: P.PUSH 7

with this one using L:
L 44 P.L: P.PUSH 7

or this IF centered script. Using recursion

IF LT P.L 44: P.PUSH 7
IF LT P.L 44: SCRIPT THIS

furthermore, you can do it as a Do…While as well:

P.PUSH 7
IF LT P.L 44: SCRIPT THIS

//
Ok, here’s another example. We want to do an action on the falling edge of a trigger:

W NZ STATE THIS: 1 // just waiting
<cmd> // happens on trigger low

Problem here is that we don’t really know how long 10,000 cycles will take, so you have to hope / assume your trigger is high for relatively short amount of time. This isn’t a multi-threaded system, so it will stop anything else in teletype from happening too.

Thus we’re still better off putting a condition check in the M script if we care about falling edges of triggers.

//
I’ve lost track of where I was going (Sorry, I’m under the weather rn), but I’d love to see examples where W is better than what we’ve already got. Sure the first example might be shorter, but if it’s only a rare use-case, I’d prefer to keep the language simpler. Obviously I’m just one person, but feel the need to throw this critique into the ring.

//
PS.
THIS is fantastic! Particularly great for example scripts & copy-paste-ing scripts.

I know there’s a limit to script recursion right now. Why is this? Are we really going to stack overflow with more than 8(?) recursive calls? If it’s more a don’t-let-the-user-do-something-silly protection, then should we consider setting the same limit for W!?

1 Like

A properly-designed scheduler will solve this. I’m working on one for R that will profile tasks to make scheduling decisions. :slight_smile:

As to while’s use case, it’s the same argument as in C. Technically, there’s nothing you can do with a while statement that you can’t do with a for statement and vice versa, but each is has its place for readability and clarifying intent.

Right now a bunch of stuff is statically allocated. I can port them to dynamic allocation to facilitate bumping limits like this with less memory consumption.

Downloaded it. Will test tonight!

Minor bug: In the PDF manual for beta 2, the alphabetical list of OPs and MODs is just one big landmass. There’s also a “# Missing Documentation” at the end of it.

1 Like

D’oh! Probably some merge symbols in there. I’ll clean it up. Thanks!

1 Like

As to while’s use case, here’s the one I put in the documentation. I don’t know if it has a musical use, but it’s harder to do with L:

Find the first iterated power of 2 greater than 100:

A 2
W LT A 100: A * A A

I’m having trouble with the jinja2 template that makes the operator table.

I fixed the bug that caused the table to not render (no carriage return before # Missing), but now the table renders the description column too wide, beyond the margins.

I tried shortening it in the template to no effect, even including cache_size=0 in the jinja2 environment, but the column size never changes. Help!

Can you try using git bisect to identify the commit that broke things?

I tried, but I can’t build some of the older documentation due to missing fonts. It seems to have showed up prior to 2.0 unless it’s a problem with my doc toolchain.

Edit: I fixed the font problems but no matter how far back I look, the table is messed up. Must be my toolchain! :frowning:

Versions from RPM -qa on the install date
docversions.txt (7.8 KB)

Python versions (pip3 freeze)
Jinja2: 2.9.6
MarkupSafe: 1.0
pandoc: 1.0.0b2
ply: 3.10
pypandoc: 1.4
pytoml: 0.1.14

That is a really really old version of Pandoc!

It is possible to install newer versions using stack (which is a Haskell package manager), I can talk you through it if needed? I use stack a lot.

You can also install it using pypandoc, but you’ll probably need to remove the currently installed version. See here. I’ve never done this.

(edit, your docversions.txt says 1.12 for Pandoc, which is just old, rather than really really old!)

1 Like

I’ll do those things once yum update is done. Thanks!

I’ll clear out the lot of them (pandocs) and start from scratch. RHEL lags behind with package versions, but I try to keep my machine safe without having to audit a whole lot of code. Flexibility suffers, though. I’m pining for Gentoo’s emerge or OpenBSD ports as I download and install libraries from source to get up-to-date for this and other projects.

Time to prepare a Gentoo VM, I guess :wink:

Apparently pypandoc says it’s clever enough to use the most up to date version it finds, you can

# expects an installed pypandoc: pip install pypandoc
from pypandoc.pandoc_download import download_pandoc
# see the documentation how to customize the installation path
# but be aware that you then need to include it in the `PATH`
download_pandoc()

If you feel like trusting the binary it downloads.

Otherwise stack is a fairly safe option…


If you go the Gentoo route, I guess we’ll see you in a few weeks… :stuck_out_tongue:

1 Like

Oh, you don’t think I have a recent Gentoo VMDK? :laughing:

Although the month-old emerge db will probably take a bit to update on my unreliable rural 3mbps connection. :upside_down_face:

1 Like

Bug detected!

L does not respect BREAK! Easy fix, will appear in beta3, which I’ll publish after some more testing.

Also, the KILL patch doesn’t appear to be working. :face_with_raised_eyebrow:

Edit: the KILL patch is missing from my repository entirely. Guess I blasted it on accident. Fix in beta3.

Beta4 will happen, so I can add trivial operators at that point.

Now, for something nontrivial: beta3 has been released! (Note: Turtle’s not working right. :frowning: Next build tomorrow.)

  • Fixed KILL
  • Fixed L + BREAK
  • Almost fixed documentation
  • Added the Turtle operator (@)
  • Did not add any docs
  • Commented some code

Turtle ops:

@ get/set
@X and @Y get/set
@POS x y
@HOME x y (with no getters)
@FENCE x1 y1 x2 y2
@BOUNCE, @BUMP, and @WRAP
@DIR (degrees)
@SPEED (cells)
@STEP forward at the current speed + direction
@FWD x and @REV x
@TURN 
@UP x, @DOWN x, @LEFT x, @RIGHT x

Send me your best Rene clones or covers of the Talk Talk song Renee.

6 Likes