Managing Variables and Namespace in Elsinore 2023

elsinore 2023 n.w
1 / 49
Embed
Share

Explore the process of setting and getting variable values, handling multiple variables, working with namespaces, and optimizing performance in Elsinore 2023. Learn about pitfalls, best practices, and strategies for efficient variable management.

  • Variables
  • Namespace
  • Elsinore 2023
  • Performance
  • Optimization

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Elsinore 2023 Setting and Getting Variable Values Ad m Brudzewsky

  2. I want to get the values of variables using an array of variable names set variables using arrays containing names and values set a default left argument for an ambivalent tradfn base a new namespace on two source namespaces query data objects, but some have missing values construct a namespace from names and values populate class fields from name value pairs convert between tables and namespaces check the value of an optional global Setting and Getting Variable Values 1

  3. I want to Get and Variable Values Ideally, safe and fast too Setting and Getting Variable Values 2

  4. Today: Set Fails if name is 'val' name,' val' Doesn't handle multiple variables { name,' '}val What if the target is another namespace? names{ ,' '} vals Not a function names{target ,' '} vals Cannot be mapped ( ) over namespaces names(target{ ,' '} )vals Might be nice to have name value pairs target{ .{ ,' '} / }names vals Slow target{ .{ ,' '}/ }('name1' val1)('name2' val2) Setting and Getting Variable Values 3

  5. Today: Set performance target{ .{ ,' '}/ }('name1' val1)('name2' val2) target WS ('name1' val1)('name2' val2) nvs 100 'Data' 42 ]runtime -c " SE{ .{ ,' '}/ }nvs" " SE WS nvs" SE{ .{ ,' '}/ }nvs 1.8E 4 | 0% * SE WS nvs 4.5E 5 | -75% Setting and Getting Variable Values 4

  6. Today: Set { .{ ,' '}/ } Setting and Getting Variable Values 5

  7. Today: Get Doesn't handle multiple variables name What if the target is another namespace? names No fallback value target names Cannot be mapped ( ) over namespaces vals(target{6:: } )names Might be nice to have name value pairs target{ .{6:: } / }names vals Slow target{ .{6:: }/ }('name1' val1)('name1' val1) Setting and Getting Variable Values 6

  8. Today: Get performance target{ .{6:: }/ }('name1' val1)('name1' val1) WG Setting and Getting Variable Values 7

  9. Today: Get target{ .{6:: }/ }('name1' val1)('name1' val1) target WG 'name1' 'name1' Setting and Getting Variable Values 8

  10. Today: Get target{ } 'name1' 'name1' target WG 'name1' 'name1' target{ . OR } 'name1' 'name1' names 100 'Data' ]runtime -c SE{ }names " SE WG names " SE{ }names 6.4E 5 | 0% SE WG names 1.7E 5 | -73% Setting and Getting Variable Values 9

  11. Today: Get target{ } 'name1' 'name1' target WG 'name1' 'name1' target{ . OR } 'name1' 'name1' names 100 'Data' ]runtime -c SE{ }names " SE WG names " SE{ . OR }names SE{ }names 6.4E 5 | 0% SE WG names 1.7E 5 | -73% SE{ . OR }names 1.6E 5 | -76% Setting and Getting Variable Values 10

  12. Today: Get Doesn't handle multiple vars name Cannot reach another namespace names No fallback value target names Cannot be mapped over namespaces vals(target{6:: } )names Slow target{ .{6:: } / }names vals Fails on namespace values target{ {6:: . OR'n' n } / }names vals target{ {6:: 2= . NC : . OR'n' n } / }names vals Setting and Getting Variable Values 11

  13. Today: Get Slow target{ {6:: 2= . NC : . OR'n' n } / }names vals Setting and Getting Variable Values 12

  14. Today: Get target{ {6:: 2= . NC : . OR'n' n } / }names vals target{_ {0=nc . NC : 2=nc: . OR'n' n } / }names vals Setting and Getting Variable Values 13

  15. Today: Get GetTrap { {6:: 2= . NC : . OR'n' n } / } GetNC {_ {0=nc . NC : 2=nc: . OR'n' n } / } names 100 'Missing' vals 100 42 ]runtime -c " SE GetTrap names vals" " SE GetNC names vals" SE GetTrap names vals 4.7E 4 | 0% SE GetNC names vals 7.6E 5 | -84% Setting and Getting Variable Values 14

  16. Today: Get {_ {0=nc . NC : 2=nc: . OR'n' n } / } Setting and Getting Variable Values 15

  17. Today: NameValues Two separate lists: (names vals) target{ ( , ) . NL }ncs Name value pairs: pairs target{ ( , ) . NL }ncs Setting and Getting Variable Values 16

  18. Today: NameValues Two separate lists: (names vals) target{ ( , ) . NL }ncs Name value pairs: pairs target{ ( , ) . NL }ncs Setting and Getting Variable Values 17

  19. Today: NameValues Two separate lists: (names vals) target{ ( , {2= . NC : . OR'n' n } ) . NL }ncs Name value pairs: pairs target{ ( , {2= . NC : . OR'n' n }) . NL }ncs Setting and Getting Variable Values 18

  20. Today: NameValues Two separate lists: (names vals) target{ ( , {2= . NC : . OR'n' n } ) . NL }ncs Name value pairs: pairs target{ ( , {2= . NC : . OR'n' n }) . NL }ncs Setting and Getting Variable Values 19

  21. OK, so what do we do about all this? Setting and Getting Variable Values 20

  22. NS: Name Set Add vars with values ref target NS ('name1' val1) ('name2' val2) Pick values from here ref target NS 'name1' 'name2' Setting and Getting Variable Values 21

  23. NS: Name Set Add vars with values ref target NS ('name1' val1) ('name2' val2) Pick values from there ref target source. NS 'name1' 'name2' Set single variable ref target NS 'name1' 'val1' Copy vars from ref ref target NS ref New namespace ref NS Two separate lists NS ( 'name1' 'name2') (val1 val2) Setting and Getting Variable Values 22

  24. NG: Name Get Values w/ fallbacks vals source NG ('name1' val1) ('name2' val2) Values w/o fallbacks vals source NG 'name1' 'name2' Single name w/ fallback vals source NG 'name1' val1 Clone w/ PCopy ref source NG ref Read THIS NG Two separate lists NG ( 'name1' 'name2') (val1 val2) Setting and Getting Variable Values 23

  25. NV: NameValues Name value pairs (name1 val1)(name2 val2) source NV 2 Two separate lists (nameMatrix valueVector) source NV 2 Read THIS NV Setting and Getting Variable Values 24

  26. source & target: flexibility Namespace reference Several references Namespace name Several names Any mixture of the above ref ref1 ref2 'name' 'name1' 'name2' ref1 'name1' ref2 everything on right to each on left result structure from left argument Setting and Getting Variable Values 25

  27. Lets see that in context! Setting and Getting Variable Values 26

  28. Get the values of variables using an array of variable names vals namespace NG names Setting and Getting Variable Values 27

  29. Get the values of variables using an array of variable names vals namespace NG names Setting and Getting Variable Values 28

  30. Set variables using arrays containing names and values namespace NS names vals Setting and Getting Variable Values 29

  31. Set variables using arrays containing names and values namespace NS( names)vals Setting and Getting Variable Values 30

  32. Set a default left argument for an ambivalent tradfn r {x} Foo y x NG 'x' 42 Setting and Getting Variable Values 31

  33. Base a new namespace on two source namespaces new input NG defaults All names from both namespaces included input s values prevail new NG/namespaces All names from all namespaces included Leftmost values prevail Setting and Getting Variable Values 32

  34. Query data objects, but some have missing values myFamily NG 'kidAges' families NG 'kidAges' myFamily NG ('kidAges' )('kidNames'(0 '')) families NG ('kidAges' )('kidNames'(0 '')) Setting and Getting Variable Values 33

  35. Construct a namespace from names and values myns NS ( names) values myns NS names values Setting and Getting Variable Values 34

  36. Populate class fields from name value pairs myInstance NS('name1' val1)('name2' val2) Setting and Getting Variable Values 35

  37. Convert table to namespace (data header) CSV path 4 1 ( data) Setting and Getting Variable Values 36

  38. Convert table to namespace (data header) CSV path 4 1 ( header) ( data) Setting and Getting Variable Values 37

  39. Convert table to namespace (data header) CSV path 4 1 namespace NS ( header) ( data) (data header) CSV( OPT'Invert' 2) path 4 1 namespace NS ( header) data Setting and Getting Variable Values 38

  40. Convert table to namespace (data header) CSV path 4 1 namespace NS ( header) ( data) (data header) CSV( OPT'Invert' 3) path 4 1 namespace NS ( header) data Setting and Getting Variable Values 39

  41. Convert table to namespace (data header) CSV path 4 1 namespace NS ( 0(7162 ) header) ( data) (data header) CSV( OPT'Invert' 2) path 4 1 namespace NS ( 0(7162 ) header) data Setting and Getting Variable Values 40

  42. Convert namespace to table (header data) namespace NV 2 data ( header) CSV path pairs namespace NV 2 (header data) pairs ]disp ( header) data Setting and Getting Variable Values 41

  43. Convert namespace to table (header data) namespace NV 2 data (1(7162 ) header) CSV path pairs namespace NV 2 (header data) pairs ]disp (1(7162 ) header) data Setting and Getting Variable Values 42

  44. Convert namespace to table ns 0 JSON'{"NUM":[1,2,3,4], "DA" :["En","To","Tre","Fire"], "EN" :["One","Two","Three","Four"]}' ns NV 2 DA EN NUM 1 2 3 4 En To Tre Fire One Two Three Four Setting and Getting Variable Values 43

  45. Convert namespace to table ns 0 JSON'{"NUM":[1,2,3,4], "DA" :["En","To","Tre","Fire"], "EN" :["One","Two","Three","Four"]}' { }/ns NV 2 DA EN NUM 1 2 3 4 En To Tre Fire One Two Three Four Setting and Getting Variable Values 44

  46. Convert namespace to table ns 0 JSON'{"NUM":[1,2,3,4], "DA" :["En","To","Tre","Fire"], "EN" :["One","Two","Three","Four"]}' { , }/ns NV 2 DA En To Tre Fire EN One Two Three Four NUM 1 2 3 4 Setting and Getting Variable Values 45

  47. Convert namespace to table ns 0 JSON'{"NUM":[1,2,3,4], "DA" :["En","To","Tre","Fire"], "EN" :["One","Two","Three","Four"]}' { , - }/ns NV 2 DA EN NUM En One 1 To Two 2 Tre Three 3 Setting and Getting Variable Values 46

  48. Check the value of an optional global NG 'DEBUG' 0 :Trap ( NG 'DEBUG' 0) 0 :Trap NG 'DEBUG' 0 Setting and Getting Variable Values 47

  49. Setting and Getting Variable Values Name Set NS name name NS (name val) NS names vals NS ref 'target' NS ref ref NS Name Get NG name name NG (name val) NG names vals NG ref 'target' NG ref ref NG Name Value NV type type NV ref 'target' NV ref ref NV ? Setting and Getting Variable Values 48

Related


More Related Content