Lists of numbers in core tiddlers

59 views
Skip to first unread message

Simon Huber

unread,
Jan 11, 2018, 6:41:49 AM1/11/18
to tiddly...@googlegroups.com
Hello, I'd like to discuss if it wouldn't be very useful to have some tiddlers in the core that hold lists with numbers

I'm using a normal list with all integers from 1 - 9999 quite often to get the next or previous value for variables or to list the first n numbers and I don't want to use math plugins for such easy things
I guess there could be other math-related usecases when I think about logarithmic tables making multiplication an addition of logarithms... (like when mankind didn't have calculators but logarithmic tables see here)

what do you think about such lists in the tiddlywiki core?

all the best,
Simon

PMario

unread,
Jan 11, 2018, 7:13:33 AM1/11/18
to TiddlyWikiDev
Hi Simon,

I think that's a very specific usecase and therefor plugin territory. ... Can you describe your usage of this list a bit closer. ... So we may be able, to dynamically create "virtual" lists, that don't stop at 9999.

My first question was: "What if I need 10000?" ...

-m



Simon Huber

unread,
Jan 11, 2018, 7:28:04 AM1/11/18
to TiddlyWikiDev
Hello @PMario,


Am Donnerstag, 11. Januar 2018 13:13:33 UTC+1 schrieb PMario:
Hi Simon,

I think that's a very specific usecase and therefor plugin territory. ... Can you describe your usage of this list a bit closer. ... So we may be able, to dynamically create "virtual" lists, that don't stop at 9999

9999 is the max i could store in a field. virtual lists would be much better, that would be a nice feature, it would add a lot of flexibility I think
  • for listing like [list<numbers>limit[100]] when I want to do something 100 times
  • for getting the next (previous) value of a variable with [<variable>next[numbertiddler]] if I need to count something that happens various times
  • various other things with lists
it would be great if something like filter="[[1 - 100]]" could be done and also [<variable>next[1 - 100]]


My first question was: "What if I need 10000?" ...

doesn't happen in my cases but you're absolutely right, it's limiting

-m

thanks for your reply,
Simon 

Simon Huber

unread,
Jan 11, 2018, 7:38:33 AM1/11/18
to TiddlyWikiDev
negative and floating numbers with a certain limitation in accuracy would also be great

PMario

unread,
Jan 11, 2018, 8:26:11 AM1/11/18
to TiddlyWikiDev
On Thursday, January 11, 2018 at 1:38:33 PM UTC+1, Simon Huber wrote:
negative and floating numbers with a certain limitation in accuracy would also be great

IMO negative numbers can be created with [addprefix[-]]

floating point will be a problem. eg: 0 -> 99.99 will create about 10,000 numbers. So users will create endless loops, without being aware.
But you could use nested INTs.

I was thinking about a syntax like: [create[1..100#04]] ... which would mean:

start: 1 .. including 1
stop: 100 .. including 100

format: #04 means
 use leading zeros
 use 4 digits

which would result in 0001 ... 0100 with every number in between

format: 1..100#03 means 001 ... 100

format: 1..100 means 1 ... 100

format: 33..55#03 means 033 ... 055

and so on.

Just some thoughts. No promises.

The problem now is, that "start" stop may be variables. ... like [create<start>..<stop>#<format>] ... which is ugly, complex and the parser can't handle it at the moment.
-m



Simon Huber

unread,
Jan 11, 2018, 9:04:06 AM1/11/18
to TiddlyWikiDev
@PMario,


Am Donnerstag, 11. Januar 2018 14:26:11 UTC+1 schrieb PMario:
On Thursday, January 11, 2018 at 1:38:33 PM UTC+1, Simon Huber wrote:
negative and floating numbers with a certain limitation in accuracy would also be great

IMO negative numbers can be created with [addprefix[-]]

you're right, that works for me 

floating point will be a problem. eg: 0 -> 99.99 will create about 10,000 numbers. So users will create endless loops, without being aware.
But you could use nested INTs.

that'd be ok 

I was thinking about a syntax like: [create[1..100#04]] ... which would mean:

start: 1 .. including 1
stop: 100 .. including 100

format: #04 means
 use leading zeros
 use 4 digits

which would result in 0001 ... 0100 with every number in between

format: 1..100#03 means 001 ... 100

format: 1..100 means 1 ... 100

format: 33..55#03 means 033 ... 055

and so on.

I like this syntax, it would offer pretty good flexibility 

Just some thoughts. No promises.

thanks, I can work around this with my own lists but with what you proposed I imagine that all kinds of things could be made easier / possible

The problem now is, that "start" stop may be variables. ... like [create<start>..<stop>#<format>] ... which is ugly, complex and the parser can't handle it at the moment.

I'd be totally fine with this if the parser could handle it, I'm lacking ideas and knowledge tbh to propose something myself at this point
 
Grüße,
Simon

Evan Balster

unread,
Jan 11, 2018, 12:21:09 PM1/11/18
to TiddlyWikiDev
Hey, Simon —


eg.  [range[-100,100,.5]] produces -100, -99.5, -99 ... 99, 99.5, 100.

It generates evenly-spaced numbers in an arbitrary range, and can deal with whatever step-size you're interested in.  The numbers produced never have more decimal points than the arguments and the range is always inclusive.

This is a more robust and high-performance implementation than can be managed with TiddlyWiki's built-in mechanisms.  It's part of my math & formulas plugin (which I'm designing as a "universal" computation plugin) but it can be used separately.  See the attached JSON file.
$__plugins_ebalster_formula_filters_range.js.tid

Simon Huber

unread,
Jan 11, 2018, 1:29:11 PM1/11/18
to TiddlyWikiDev
Hey Evan,

oh man, it's really worth looking a bit deeper into what you made there - this is perfect,
thank you for pointing this out!

Am Donnerstag, 11. Januar 2018 18:21:09 UTC+1 schrieb Evan Balster:
Hey, Simon —


eg.  [range[-100,100,.5]] produces -100, -99.5, -99 ... 99, 99.5, 100.

It generates evenly-spaced numbers in an arbitrary range, and can deal with whatever step-size you're interested in.  The numbers produced never have more decimal points than the arguments and the range is always inclusive.

This is a more robust and high-performance implementation than can be managed with TiddlyWiki's built-in mechanisms.  It's part of my math & formulas plugin (which I'm designing as a "universal" computation plugin) but it can be used separately.  See the attached JSON file.

 
now this is gonna be my new allrounder

thanks, Evan!

all the best,
Simon
Reply all
Reply to author
Forward
0 new messages