Ideas for convenient JME syntax or functions?

16 views
Skip to first unread message

Christian Lawson-Perfect

unread,
Nov 4, 2021, 10:52:45 AM11/4/21
to numbas...@googlegroups.com
I think that one of the best features of the JME syntax is the 'except' operator, for example `random(-5..5 except 0)`. I use it all the time!

Over the years, I've added lots of new functions to JME, but I don't think I've added enough of these smart features to improve readability.

Is there anything you find yourself doing a lot in JME that ends up looking like gibberish, or could be compressed into a single operation?

One example I'm not particularly happy with is the map and filter functions - I'd really like Python-style list comprehensions, where `[fn(x) for x in y]` is equivalent to `map(fn(x), x, y)`.

Any others?

Mike Proudman

unread,
Nov 10, 2021, 3:13:13 AM11/10/21
to Numbas Users
One that I would value (because, as you say, I end up write lengthy and cumbersome gibberish) would be an extension to the "except" operator.
What I would like is an "except all the other random variables I have created". i.e. When creating 5 or 6 variables and you don't want repeats. Perhaps could be done with an "except group"?

Reply all
Reply to author
Forward
0 new messages