Thanks for the reply Evan this seems like a really useful feature

On Thursday, February 1, 2018 at 3:24:58 PM UTC-6, Evan Balster wrote:
>
> Hey, Diego —
>
> I've been interested in supporting "cascading" in a single widget in 
> formula-vars, but there's no way for a widget to know the order in which 
> attributes are written with certainty.  For that reason and because I've 
> now implemented "cascading" in formulas' LET construct, I've been thinking 
> about adding an idiom for constructing key-value objects in formulas, and 
> making it possible to export one of these as a set of TiddlyWiki variables.
>
> That would look something like this:
>
> <$formula-vars $dict="""
>   dict(
>     t1 = 0,
>     t2 = <<newVal>>,
>     t3 = 3+1,
>     t4 = t3+20)
>   """>
>   ...
> </$formula-vars>
>
> At which point the primitive objects usable in formulas start to look a 
> lot like JavaScript's!  Hashmaps (aka "objects" aka "dictionaries") are 
> useful for lots of things...
>
> On Thursday, 1 February 2018 15:07:36 UTC-6, Diego Mesa wrote:
>>
>> Update: 
>>
>> This cascading does indeed work:
>>
>> <$button >
>> <$formula-vars val1="2+3">
>> <$action-setfield $field="t1" $value=<<val1>>/>
>> <$formula-vars val2="<<val1>> + 10">
>> <$action-setfield $field="t2" $value=<<val2>>/>
>> <$formula-vars val3="<<val2>> + 100">
>> <$action-setfield $field="t3" $value=<<val3>>/>
>> </$formula-vars>
>> </$formula-vars>
>> </$formula-vars>
>> Do it!
>> </$button>
>>
>>
>>
>> On Thursday, February 1, 2018 at 2:57:44 PM UTC-6, Diego Mesa wrote:
>>>
>>> Hey all,
>>>
>>> Sorry a better example of what Im trying to accomplish:
>>>
>>> <$button >
>>> <$formula-vars val1="2+3" val2="<<val1>>+6" val3="{{!!t2}}+12">
>>> <$action-setfield $field="t1" $value=<<val1>>/>
>>> <$action-setfield $field="t2" $value=<<val2>>/>
>>> <$action-setfield $field="t3" $value=<<val3>>/>
>>> </$formula-vars>
>>> Do it!
>>> </$button>
>>>
>>>
>>> I can understand why it wouldn't work, but it seems tobias' excellent 
>>> setvars plugin will allow you to do something like this:
>>>
>>>
>>> <$setvars
>>> _attr1=<<currentTiddler>>
>>> _attr2={{!!title}}
>>> _attr3="1 2 3"
>>> _attr4="[all[current]tagging[]]"
>>> var1="attr1 \ = literal = \ attr2"
>>> var2="attr3[n] \ \ [attr4[1,2][when-empty]] \ \ [attr3[][][ - ]]"
>>> var3="if(attr1 ? [attr4]) || attr3 attr2"
>>> var4="if(attr1 == attr2 ? attr3[1]) || [attr3[2]]">
>>> * <<var1>>
>>> * <<var2>>
>>> * <<var3>>
>>> * <<var4>>
>>> </$setvars>
>>>
>>>
>>>  Does formula let you do this type of cascading? 
>>>
>>> On Thursday, February 1, 2018 at 2:32:34 PM UTC-6, Diego Mesa wrote:
>>>>
>>>> Hey all,
>>>>
>>>> I am trying to use this plugin in button actions like so:
>>>>
>>>> \define updateActions(newVal)
>>>>> <$action-setfield $field="t1" $value="0"/>
>>>>> <$action-setfield $field="t2" $value=$newVal$/>
>>>>> <$action-setfield $field="t3" $value=(=3+1=)/>
>>>>> <$action-setfield $field="t4" $value=(={{!!t3}}+20=)/>
>>>>> \end
>>>>>
>>>>>
>>>>> <$button actions=<<updateActions 10>> >
>>>>> Do it!
>>>>> </$button>
>>>>>
>>>>
>>>>
>>>> I am trying to make a spaced-repetition system like this. Any help 
>>>> would be greately appreciated! 
>>>>
>>>>
>>>> On Friday, January 19, 2018 at 2:44:29 PM UTC-6, Evan Balster wrote:
>>>>>
>>>>> Both formats look good, so I'll take the best parts of each:
>>>>>
>>>>>    - Unit tests:
>>>>>       - Tiddlers tagged with FormulaTest.
>>>>>       - Text is expected to render to TRUE
>>>>>          - Advanced: If the field match is present on the tiddler, 
>>>>>          text is instead expected to render to the same result as 
>>>>> rendering 
>>>>>          match.
>>>>>       - Name using a prefix scheme based on the test subject
>>>>>          - Bugs: FormulaTest/Regression/<Test Name>
>>>>>          - Functions: FormulaTest/Functions/<Function Name>/<Test 
>>>>>          Name>
>>>>>             - Function names in ALL CAPS
>>>>>          - Language: FormulaTest/Feature/<Feature Name>/<Test Name>
>>>>>             - Feature names being things like "Let", "Function", 
>>>>>             "Closure", "Transclude"
>>>>>          - Syntax & Compilation: FormulaTest/Compiler/<Feature 
>>>>>          Name>/<Test Name>
>>>>>          - Miscellaneous Tests: FormulaTest/Misc/<Test Name>
>>>>>       - Additional tiddlers used as data in unit tests:
>>>>>       - Tag with FormulaTestData.
>>>>>       - Prefix with the unit test's fully-prefixed name, with an 
>>>>>       additional slash and name.
>>>>>    
>>>>> Ideally, unit tests and bug repros should be submitted on GitHub (see 
>>>>> my call for unit tests there 
>>>>> <https://github.com/EvanBalster/TiddlyWikiFormula/issues/17>) but 
>>>>> uploading JSON files in this thread is OK too.
>>>>>
>>>>> On Friday, 19 January 2018 10:37:43 UTC-6, Diego Mesa wrote:
>>>>>>
>>>>>> Hey Evan,
>>>>>>
>>>>>> I was going to start adding some more, but the format you described 
>>>>>> above is slightly different than the previous one:
>>>>>>
>>>>>>
>>>>>> http://evanbalster.com/tiddlywiki/formulas.html#UnitTest%2FFunctions%2Fnth%2Fsorted-return
>>>>>>
>>>>>> Which do you think we should stick with?
>>>>>>
>>>>>> Diego 
>>>>>>
>>>>>> On Friday, January 19, 2018 at 1:28:44 AM UTC-6, Evan Balster wrote:
>>>>>>>
>>>>>>> Bug(s) confirmed — array and date formatting aren't working 
>>>>>>> correctly.  Need to investigate why.
>>>>>>>
>>>>>>> There is also an issue with parsing block comments in Formula 0.2.1, 
>>>>>>> which has been fixed in the repo.
>>>>>>>
>>>>>>> Suggested format for unit-test and bug-repro contributions:
>>>>>>>
>>>>>>>    - Tag with "FormulaTest"
>>>>>>>    - Prefix "Test/"
>>>>>>>    - Text comprises a single formula construct (of any type) whose 
>>>>>>>    result should render to TRUE, *or* match the result of rendering 
>>>>>>> field 
>>>>>>>    "match" of the tiddler if present.
>>>>>>>    - Submitted as JSON files here
>>>>>>>
>>>>>>>
>>>>>>> On Thursday, 18 January 2018 22:18:55 UTC-6, Mr. Mal wrote:
>>>>>>>>
>>>>>>>> I think the now and date function not working in this release. May 
>>>>>>>> be others can confirm this "bug". 
>>>>>>>>
>>>>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/38a0c0b2-eacc-48b9-8ac9-4a938aa694d5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to