Data update
This commit is contained in:
parent
4d5544505c
commit
4924dd0264
3073 changed files with 55820 additions and 4408 deletions
7
Task/Copy-a-string/ArkScript/copy-a-string.ark
Normal file
7
Task/Copy-a-string/ArkScript/copy-a-string.ark
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
(mut str "hello world")
|
||||
(mut copy str)
|
||||
|
||||
(set copy "clone destroyed")
|
||||
|
||||
(print str)
|
||||
(print copy)
|
||||
40
Task/Copy-a-string/DuckDB/copy-a-string.duckdb
Normal file
40
Task/Copy-a-string/DuckDB/copy-a-string.duckdb
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
D create or replace table t as (select 'This is a string' as s);
|
||||
|
||||
D from t;
|
||||
┌──────────────────┐
|
||||
│ s │
|
||||
│ varchar │
|
||||
├──────────────────┤
|
||||
│ This is a string │
|
||||
└──────────────────┘
|
||||
|
||||
# Now make two copies.
|
||||
D create or replace table tt as (select s as s1, s as s2 from t);
|
||||
|
||||
D from tt;
|
||||
┌──────────────────┬──────────────────┐
|
||||
│ s1 │ s2 │
|
||||
│ varchar │ varchar │
|
||||
├──────────────────┼──────────────────┤
|
||||
│ This is a string │ This is a string │
|
||||
└──────────────────┴──────────────────┘
|
||||
|
||||
# Change s2 and then verify that s1 is unaltered
|
||||
D UPDATE tt SET s2 = s2[1];
|
||||
|
||||
D from tt;
|
||||
┌──────────────────┬─────────┐
|
||||
│ s1 │ s2 │
|
||||
│ varchar │ varchar │
|
||||
├──────────────────┼─────────┤
|
||||
│ This is a string │ T │
|
||||
└──────────────────┴─────────┘
|
||||
|
||||
# Check that s and s1 are also still equal
|
||||
D select s = s1 from t positional join tt;
|
||||
┌──────────┐
|
||||
│ (s = s1) │
|
||||
│ boolean │
|
||||
├──────────┤
|
||||
│ true │
|
||||
└──────────┘
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
10 A$ = "HELLO"
|
||||
20 REM COPY CONTENTS OF A$ TO B$
|
||||
30 B$ = A$
|
||||
40 REM CHANGE CONTENTS OF A$
|
||||
50 A$ = "WORLD"
|
||||
60 REM DISPLAY CONTENTS
|
||||
70 PRINT A$, B$
|
||||
6
Task/Copy-a-string/TAV/copy-a-string.tav
Normal file
6
Task/Copy-a-string/TAV/copy-a-string.tav
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
s =: "hello"
|
||||
print s.Usecount
|
||||
t =: s \ reference copy
|
||||
print s.Usecount
|
||||
u =: string (s _ 'x') clip upto -2
|
||||
print (quote u), u.Usecount, s.Usecount
|
||||
Loading…
Add table
Add a link
Reference in a new issue