Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-implement Quantity values #1165

Merged
merged 1,005 commits into from
Jun 12, 2023
Merged
Show file tree
Hide file tree
Changes from 238 commits
Commits
Show all changes
1005 commits
Select commit Hold shift + click to select a range
da779d8
add support for property-predicate examples
drkameleon May 3, 2023
405a1f6
added examples for each and every one of the properties supported (fo…
drkameleon May 3, 2023
bc92d62
build update
drkameleon May 3, 2023
47e20cf
removed debugging output
drkameleon May 3, 2023
5eadf58
build update
drkameleon May 3, 2023
06a3e48
build update
drkameleon May 3, 2023
c0711ec
build update
drkameleon May 3, 2023
668933c
build update
drkameleon May 3, 2023
02ee8fd
another fix
drkameleon May 3, 2023
ecc93cb
build update
drkameleon May 3, 2023
4e0c192
build update
drkameleon May 3, 2023
76375d2
build update
drkameleon May 3, 2023
de30889
build update
drkameleon May 3, 2023
fcdafbf
build update
drkameleon May 3, 2023
e78bd51
build update
drkameleon May 3, 2023
c571435
build update
drkameleon May 3, 2023
99e293e
build update
drkameleon May 3, 2023
0cffe3f
build update
drkameleon May 4, 2023
7e9a909
debugging
drkameleon May 4, 2023
8bb1265
Converters: fixed `to` for Block -> Quantity pairs
drkameleon May 4, 2023
4f06b37
build update
drkameleon May 4, 2023
fd6199f
build update
drkameleon May 4, 2023
0d10126
build update
drkameleon May 4, 2023
16e5176
build update
drkameleon May 4, 2023
e750c96
build update
drkameleon May 4, 2023
ea48b94
Converters/to: added support for Rational values in Block -> Quantity…
drkameleon May 4, 2023
fae8c82
VM/ast: added `addBuiltinCall` helper + treat Quantity values at AST …
drkameleon May 4, 2023
340d03b
build update
drkameleon May 4, 2023
c98b348
build update
drkameleon May 4, 2023
2d52634
minor fix
drkameleon May 4, 2023
7575aaa
commented-out debugging output
drkameleon May 4, 2023
6991851
VM/values/custom/vquantity: added `containsUserUnits` helper
drkameleon May 4, 2023
7c65df3
VM/ast: perform AST transformations for Quantity values only if they …
drkameleon May 4, 2023
6335cc3
build update
drkameleon May 4, 2023
c2e61f1
import vquantity (we need it for `containsUserUnits`)
drkameleon May 4, 2023
17c03ed
build update
drkameleon May 4, 2023
91e6946
build update
drkameleon May 4, 2023
6bc8894
build update
drkameleon May 4, 2023
56dc749
build update
drkameleon May 4, 2023
e78ba08
build update
drkameleon May 4, 2023
c9dee4a
build update
drkameleon May 4, 2023
1f15986
build update
drkameleon May 4, 2023
7193b5c
build update
drkameleon May 4, 2023
7ad8d7b
build update
drkameleon May 4, 2023
0b06a19
build update
drkameleon May 4, 2023
e8e1b2a
build update
drkameleon May 4, 2023
d0a82e6
build update
drkameleon May 4, 2023
b9dccca
build update
drkameleon May 4, 2023
d356cd2
Quantities: added new `specify` method
drkameleon May 4, 2023
a39afe1
minor fix
drkameleon May 4, 2023
6e4e255
added new `withUserUnits` field
drkameleon May 4, 2023
add2713
minor fix
drkameleon May 4, 2023
b1b442f
Merge branch 'master' of https://github.com/arturo-lang/arturo into r…
drkameleon May 4, 2023
a551686
build update
drkameleon May 4, 2023
dbf5925
better adjustment for user-defined unit-less units
drkameleon May 4, 2023
2804b49
Quantities/specify: added `.symbol:`, `.describes:`, `.property`
drkameleon May 4, 2023
67521c2
VM/values/custom/vquantity: added new `defineNewProperty` helper
drkameleon May 4, 2023
81c6a01
build update
drkameleon May 4, 2023
6bbc609
build update
drkameleon May 4, 2023
fc88678
Quantities/specify: added complete implementation for `.describes:`, …
drkameleon May 4, 2023
6789f38
cleanup
drkameleon May 4, 2023
8401047
build update
drkameleon May 4, 2023
c6ca6e7
build update
drkameleon May 4, 2023
eb4d870
removed debugging output
drkameleon May 4, 2023
dc4740c
Quantities: added new `unit` method
drkameleon May 5, 2023
17ea44e
build update
drkameleon May 5, 2023
50262c2
added `newRational` constructor for Rat values (bignum rational)
drkameleon May 5, 2023
27a5738
VM/values/custom/vrational: added `toRational` constructor for Rat va…
drkameleon May 5, 2023
28acd01
Quantities: added new `scalar` built-in method
drkameleon May 5, 2023
f191c7c
build update
drkameleon May 5, 2023
00002cd
minor fix
drkameleon May 5, 2023
a48cd0a
build update
drkameleon May 5, 2023
ed35149
VM/values/operators: added Unit support for `*` & `*=` overloads
drkameleon May 5, 2023
08fe650
build update
drkameleon May 5, 2023
d5e3938
added `*` support for float-VRational
drkameleon May 5, 2023
02ea01b
build update
drkameleon May 5, 2023
34909ab
build update
drkameleon May 5, 2023
a9b8c94
Converters: added Quantity -> X conversion support
drkameleon May 5, 2023
be386e0
build update
drkameleon May 5, 2023
c0feebd
build update
drkameleon May 5, 2023
120c7e8
Converters: added Quantity conversion support + cleanup
drkameleon May 5, 2023
2dd88da
build update
drkameleon May 5, 2023
a4a5d33
VM/values/printable: [identical] added clause for Quantity values
drkameleon May 5, 2023
469c97f
Quantities/conforms?: added documentation example
drkameleon May 5, 2023
297a126
removed TODO
drkameleon May 5, 2023
f074dc3
minor edit
drkameleon May 5, 2023
378a686
Quantities/property: added documentation example
drkameleon May 5, 2023
33e8e90
added `getProperty` overload for Unit values
drkameleon May 5, 2023
8a78ff7
Quantities/property: added `hash` option + support for Unit values
drkameleon May 5, 2023
9b2995d
Quantities/scalar: added documentation example
drkameleon May 5, 2023
1e0728e
removed TODO
drkameleon May 5, 2023
3aa48f8
Quantities/specify: added documentation example
drkameleon May 5, 2023
d96b34d
removed TODO
drkameleon May 5, 2023
651d531
Quantities/convert: fixed documentation example
drkameleon May 5, 2023
b3d34e6
Quantities: renamed `unit` to `units`
drkameleon May 5, 2023
4026da3
Quantities/units: added new `.base` option
drkameleon May 5, 2023
e61c716
build update
drkameleon May 5, 2023
1883909
removed TODO
drkameleon May 5, 2023
3144be0
added `toBase` & `getBaseUnits` overloads for Unit values
drkameleon May 5, 2023
b91a46a
Quantities/units: added support for Unit values
drkameleon May 5, 2023
6757ab3
build update
drkameleon May 5, 2023
d669eef
VM/values/custom/vquantity: mark a-la-carte units as base units (unti…
drkameleon May 5, 2023
4f778c4
Quantity/units: added documentation examples
drkameleon May 5, 2023
03f102f
removed TODO
drkameleon May 5, 2023
93e1b8c
build update
drkameleon May 5, 2023
9b8e723
added new *colonequal* (`:=`) symbol
drkameleon May 5, 2023
c0e30a7
VM/parse: added parsing support for new `:=` (colonequal) symbol
drkameleon May 5, 2023
171f9ac
Quantities/conforms?: added infix symbol to `:=` (colonequal)
drkameleon May 5, 2023
a8242f0
Quantities/conforms?: updated documentation examples
drkameleon May 5, 2023
b77069c
build update
drkameleon May 5, 2023
e84d29b
updated unit-test (changed character literal syntax)
drkameleon May 5, 2023
34628db
updated unit-test
drkameleon May 5, 2023
1f58bc9
temporarily disabled unit-test
drkameleon May 5, 2023
f35c991
minor edit
drkameleon May 5, 2023
44ce4fa
updated expected results
drkameleon May 5, 2023
b05be48
updated expected unit-test result
drkameleon May 5, 2023
b48af6c
minor update
drkameleon May 5, 2023
d3d9db3
VM/values/custom/vrational: added `==` support for VRational <-> int
drkameleon May 5, 2023
b26f6ca
VM/values/custom/vrational: added proper `==` support for VRational <…
drkameleon May 5, 2023
a2c762d
VM/values/custom/vrational: added proper `==` overload for VRational …
drkameleon May 5, 2023
972aeb0
added remaining `<` & `>` overloads for Rational values
drkameleon May 5, 2023
cdc6708
build update
drkameleon May 5, 2023
4b9e498
build update
drkameleon May 5, 2023
8185478
fixed `codify`
drkameleon May 5, 2023
74be6d8
minor fix
drkameleon May 5, 2023
a60382d
build update
drkameleon May 5, 2023
397fa91
"updated" unit-test
drkameleon May 5, 2023
8281ecd
updated expected results
drkameleon May 5, 2023
dbdf941
build update
drkameleon May 5, 2023
53cae0a
build update
drkameleon May 5, 2023
2fd42b0
build update
drkameleon May 5, 2023
6167942
build update
drkameleon May 5, 2023
50c2c85
build update
drkameleon May 5, 2023
5df4283
debugging
drkameleon May 5, 2023
3b69978
build update
drkameleon May 5, 2023
394b87c
build update
drkameleon May 5, 2023
dcfe828
removed debugging leftovers...
drkameleon May 5, 2023
d94d317
cleaned up unit-test
drkameleon May 5, 2023
455de33
temporarily disabled unit-test
drkameleon May 5, 2023
2c38555
temporarily disabled unit-test
drkameleon May 5, 2023
c806b58
build update
drkameleon May 5, 2023
0ff01f2
build update
drkameleon May 5, 2023
36b3cf3
build update
drkameleon May 8, 2023
80edfc6
no message
drkameleon May 11, 2023
8b49292
build update
drkameleon May 11, 2023
8b82c02
Merge branch 'master' of https://github.com/arturo-lang/arturo into r…
drkameleon May 11, 2023
2fd4d30
build update
drkameleon May 19, 2023
6fee6de
update unit-test
drkameleon May 29, 2023
989ec9f
build update
drkameleon May 30, 2023
b248468
build update
drkameleon May 30, 2023
3dc951b
merge from master branch
drkameleon May 30, 2023
535a103
build update
drkameleon May 30, 2023
0a359fa
VM/values/comparison: wrap `.bi` reference inside MINI build check (`…
drkameleon May 30, 2023
38515cc
build update
drkameleon May 30, 2023
fcdf8d7
don't define constants unless we are in the FULL version
drkameleon May 31, 2023
48f04da
build update
drkameleon May 31, 2023
ae27b84
build update
drkameleon May 31, 2023
96e0d5a
build update
drkameleon May 31, 2023
f52653b
[Numbers\acos] add `:rational` support
RickBarretto May 31, 2023
6beaeee
[Numbers\acosh] add `:rational` support
RickBarretto May 31, 2023
8bb26bd
[Numbers\acsec] add `:rational` support
RickBarretto May 31, 2023
9cf77d2
[Numbers\acsech] add `:rational` support
RickBarretto May 31, 2023
55e31f2
[Numbers\actan] add `:rational` support
RickBarretto May 31, 2023
69d9dcb
[Numbers\actanh] add `:rational` support
RickBarretto May 31, 2023
c83b7e8
[Numbers\asec] add `:rational` support
RickBarretto May 31, 2023
c507347
[Numbers\asech] add `:rational` support
RickBarretto May 31, 2023
91a7171
[Numbers\asin] add `:rational` support
RickBarretto May 31, 2023
e119f40
[Numbers\asinh] add `:rational` support
RickBarretto May 31, 2023
f14235a
[Numbers\atan] add `:rational` support
RickBarretto May 31, 2023
0fa4598
[Numbers\atan2] add `:rational` support
RickBarretto May 31, 2023
143646e
[Numbers\atanh] add `:rational` support
RickBarretto May 31, 2023
dde9841
[Numbers\cos] add `:rational` support
RickBarretto May 31, 2023
bf3ce90
[Numbers\cosh] add `:rational` support
RickBarretto May 31, 2023
d51fc07
[Numbers\csec] add `:rational` support
RickBarretto May 31, 2023
e47a6ac
[Numbers\csech] add `:rational` support
RickBarretto May 31, 2023
5fe1e95
[Numbers\ctan] add `:rational` support
RickBarretto May 31, 2023
1a36458
[Numbers\ctanh] add `:rational` support
RickBarretto May 31, 2023
c411b30
[Numbers\exp] add `:rational` support
RickBarretto May 31, 2023
e67af76
[Numbers\gamma] add `:rational` support
RickBarretto May 31, 2023
9436a15
[Numbers\hypot] add `:rational` support
RickBarretto May 31, 2023
e032c69
[Numbers\ln] add `:rational` support
RickBarretto May 31, 2023
21d590c
[Numbers\log] add `:rational` support
RickBarretto May 31, 2023
3eee666
[Numbers\random] add `:rational` support
RickBarretto May 31, 2023
05ee1f2
[Numbers\sec] add `:rational` support
RickBarretto May 31, 2023
bb51f18
[Numbers\sech] add `:rational` support
RickBarretto May 31, 2023
d0e5f1f
[Numbers\sin] add `:rational` support
RickBarretto May 31, 2023
35e17e2
[Numbers\sinh] add `:rational` support
RickBarretto May 31, 2023
51207c5
[Numbers\sqrt] add `:rational` support
RickBarretto May 31, 2023
65e6637
[Numbers\sum] add `:rational` support
RickBarretto May 31, 2023
5a20315
[Numbers\tan] add `:rational` support
RickBarretto May 31, 2023
4502383
[Numbers\tanh] add `:rational` support
RickBarretto May 31, 2023
539a926
[Numbers\product] add `:rational` support
RickBarretto May 31, 2023
1edd6e8
[Numbers] remove TODO
RickBarretto May 31, 2023
bdbacdc
Merge branch 'master' into issue-1185-add-rational-supports-to-number…
drkameleon Jun 1, 2023
d75abe8
update evaluator test
drkameleon Jun 1, 2023
ab3c1e9
updated expected result
drkameleon Jun 1, 2023
430a64f
sanitize lib.arithmetic unit-test (let's not use EUR/USD since they i…
drkameleon Jun 1, 2023
282a386
merge <-- master
drkameleon Jun 1, 2023
1934df2
temporarily disable x86 workflows (to see if the rest works fine)
drkameleon Jun 5, 2023
fa0b681
minor experiment
drkameleon Jun 5, 2023
b27a288
more experimenting...
drkameleon Jun 5, 2023
aa68ea8
also remove arm builds for Linux (temporarily?)
drkameleon Jun 5, 2023
48dc6f8
remove `safeToRational` (we don't need but for the 32-bit builds)
drkameleon Jun 5, 2023
d9f4c76
build update
drkameleon Jun 5, 2023
c1bf753
build update
drkameleon Jun 5, 2023
9cf18c5
build update
drkameleon Jun 6, 2023
9c1f1e3
build update
drkameleon Jun 6, 2023
fbb3b90
build update
drkameleon Jun 6, 2023
f034737
build update
drkameleon Jun 6, 2023
cfa18db
build update
drkameleon Jun 6, 2023
cacc172
Reflection/quantity?: added `.big` option
drkameleon Jun 6, 2023
846dcf4
build update
drkameleon Jun 6, 2023
f1e3f9f
build update
drkameleon Jun 6, 2023
50c6b76
build update
drkameleon Jun 6, 2023
5ade1ee
build update
drkameleon Jun 6, 2023
e4d220d
build update
drkameleon Jun 6, 2023
abe94eb
build update
drkameleon Jun 6, 2023
8710255
build update
drkameleon Jun 6, 2023
24d75b1
build update
drkameleon Jun 6, 2023
72143ee
debugging (mostly...)
drkameleon Jun 6, 2023
5432b26
debugging again
drkameleon Jun 6, 2023
409534e
more debugging (+ possible fix)
drkameleon Jun 6, 2023
5f799de
debugging
drkameleon Jun 6, 2023
bb89847
remove debugging output
drkameleon Jun 6, 2023
a21b009
remove debugging output
drkameleon Jun 6, 2023
24189fd
build update
drkameleon Jun 6, 2023
3cd8d8b
remove debugging output
drkameleon Jun 6, 2023
cbc6be0
build update
drkameleon Jun 6, 2023
dda057a
build update
drkameleon Jun 10, 2023
c63ad9e
build update
drkameleon Jun 10, 2023
70113d9
Globals/setSym: added `forceReadOnly` compile-time option, to force r…
drkameleon Jun 10, 2023
d0be839
build update
drkameleon Jun 10, 2023
899b16f
build update
drkameleon Jun 10, 2023
88e22ff
build update
drkameleon Jun 12, 2023
6aac723
build update
drkameleon Jun 12, 2023
2a96799
re-enable "Bell numbers" RC example
drkameleon Jun 12, 2023
62eb548
re-enable "Logistic curve fitting in epidemiology" RC example
drkameleon Jun 12, 2023
ac546e3
re-enable "Primorial numbers" RC example
drkameleon Jun 12, 2023
a908efa
re-enable "Gamma function" RC example
drkameleon Jun 12, 2023
c929ad8
exclude "Bell's numbers" from CI actions
drkameleon Jun 12, 2023
898baa1
minor fix
drkameleon Jun 12, 2023
802f02d
updated "Gamma function" RC example
drkameleon Jun 12, 2023
4c3b45e
updated quantities unit-test
drkameleon Jun 12, 2023
2fe8d44
temporarily disable "Gamma function"
drkameleon Jun 12, 2023
7639a03
also disable Quantities unit-test for MINI builds
drkameleon Jun 12, 2023
60c15a1
temporarily disable "Primorial numbers" RC example
drkameleon Jun 12, 2023
03e0256
minor fix
drkameleon Jun 12, 2023
87fd539
Merge pull request #1198 from RickBarretto/issue-1185-add-rational-su…
drkameleon Jun 12, 2023
7d4ed84
added Rational support to `processTrigonometric`
drkameleon Jun 12, 2023
3eab36c
build update
drkameleon Jun 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/rosetta/arithmetic - rational.art
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ print ["a % b :" a % b]
print ["reciprocal b:" reciprocal b]
print ["neg a:" neg a]

print ["pi ~=" to :rational 3.14]
print ["pi ~=" to :rational pi]
2 changes: 1 addition & 1 deletion examples/rosetta/arithmetic - rational.res
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ a // b : 2/3
a % b : 1/2
reciprocal b: 4/3
neg a: -1/2
pi ~= 157/50
pi ~= 817696623/260280919
6 changes: 3 additions & 3 deletions examples/rosetta/bacon cipher.art
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ encodeBacon: function [plaintext,message][
cnt: 0
loop lower message 'c [
if? lower? c [
'result ++ (et\[cnt] = `A`)? -> c -> upper c
'result ++ (et\[cnt] = 'A')? -> c -> upper c
cnt: cnt + 1
if cnt = size et -> break
]
Expand All @@ -34,8 +34,8 @@ decodeBacon: function [message][
result: ""
loop message 'c [
if or? lower? c upper? c [
if? lower? c -> 'et ++ `A`
else -> 'et ++ `B`
if? lower? c -> 'et ++ 'A'
else -> 'et ++ 'B'

if 5 = size et [
if? key? RevCodes et -> 'result ++ RevCodes\[et]
Expand Down
2 changes: 1 addition & 1 deletion examples/rosetta/base 16 numbers needing a to f.art
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
needsAF?: function [x][
hex: as.hex x
loop `a`..`f` 'c [
loop 'a'..'f' 'c [
if contains? hex c ->
return true
]
Expand Down
2 changes: 1 addition & 1 deletion examples/rosetta/bioinformatics - subsequence.art
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
bases: [`A` `G` `C` `T`]
bases: ['A' 'G' 'C' 'T']
randSeq: join map 1..200 => [sample bases]
randSub: join map 1..4 => [sample bases]

Expand Down
8 changes: 4 additions & 4 deletions examples/rosetta/caesar cipher.art
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ia: to :integer `a`
iA: to :integer `A`
lowAZ: `a`..`z`
uppAZ: `A`..`Z`
ia: to :integer 'a'
iA: to :integer 'A'
lowAZ: 'a'..'z'
uppAZ: 'A'..'Z'

caesar: function [s, xx][
k: (not? null? attr 'decode)? -> 26-xx -> xx
Expand Down
4 changes: 2 additions & 2 deletions examples/rosetta/camel case and snake case.art
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ camelToSnake: function [str][
while [i < size str][
ch: str\[i]
if? upper? ch [
'result ++ `_` ++ lower str\[i]
'result ++ '_' ++ lower str\[i]
]
else [
'result ++ str\[i]
Expand All @@ -20,7 +20,7 @@ snakeToCamel: function [str][
result: ""
while [i < size str][
ch: str\[i]
if? and? [ch=`_`][(i+1) < size str] [
if? and? [ch='_'][(i+1) < size str] [
'result ++ upper str\[i+1]
inc 'i
]
Expand Down
4 changes: 2 additions & 2 deletions examples/rosetta/cantor set.art
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
width: 81
height: 5

lines: array.of: height repeat `*` width
lines: array.of: height repeat '*' width

cantor: function [start length idx].export:[lines][
seg: length / 3
if seg = 0 -> return null

loop idx..dec height 'i [
loop (start + seg).. dec start + 2 * seg 'j
-> set lines\[i] j ` `
-> set lines\[i] j ' '
]
cantor start seg idx+1
cantor start + 2 * seg seg idx+1
Expand Down
2 changes: 1 addition & 1 deletion examples/rosetta/character codes.art
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
print to :integer first "a"
print to :integer `a`
print to :integer 'a'
print to :char 97
8 changes: 4 additions & 4 deletions examples/rosetta/cusip.art
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
validCUSIP?: function [cusip][
s: 0
alpha: `A`..`Z`
alpha: 'A'..'Z'

loop.with:'i chop cusip 'c [
v: 0

case ø
when? [numeric? c] -> v: to :integer to :string c
when? [in? c alpha] -> v: (index alpha c) + 1 + 9
when? [c = `*`] -> v: 36
when? [c = `@`] -> v: 37
when? [c = `#`] -> v: 38
when? [c = '*'] -> v: 36
when? [c = '@'] -> v: 37
when? [c = '#'] -> v: 38
else []

if odd? i -> v: 2 * v
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ lim: 100
loop 1..10000 'n [
'f * n
str: to :string f
'su + (enumerate str 'c -> c = `0`) // size str
'su + (enumerate str 'c -> c = '0') // size str
if n = lim [
print [n ":" su // n]
'lim * 10
Expand Down
2 changes: 1 addition & 1 deletion examples/rosetta/evolutionary algorithm.art
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
target: "METHINKS IT IS LIKE A WEASEL"
alphabet: [` `] ++ @`A`..`Z`
alphabet: [' '] ++ @'A'..'Z'
p: 0.05
c: 100

Expand Down
2 changes: 1 addition & 1 deletion examples/rosetta/fasta format.art
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ parseFasta: function [data][
result: #[]
current: ø
loop split.lines data 'line [
if? `>` = first line [
if? '>' = first line [
current: slice line 1 (size line)-1
set result current ""
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
words: read.lines relative "unixdict.txt"
vowels: [`a` `e` `i` `o` `u`]
vowels: ['a' 'e' 'i' 'o' 'u']
alternatingVC?: function [w][
lookForConsonant: true
if contains? vowels first w -> lookForConsonant: false
Expand Down
2 changes: 1 addition & 1 deletion examples/rosetta/happy numbers.art
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ord0: to :integer `0`
ord0: to :integer '0'
happy?: function [x][
n: x
past: []
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
print ["lowercase letters:" @`a`..`z`]
print ["uppercase letters:" @`A`..`Z`]
print ["lowercase letters:" @'a'..'z']
print ["uppercase letters:" @'A'..'Z']
4 changes: 2 additions & 2 deletions examples/rosetta/mayan numerals.art
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ draw: function [mayans][
loop 0..3 'j [
prints HB
]
prints (i < idx)? -> UC -> UR ++ `\n`
prints (i < idx)? -> UC -> UR ++ '\n'
]

loop 1..4 'i [
Expand All @@ -57,7 +57,7 @@ draw: function [mayans][
loop 0..idx 'i [
loop 0..3 'j ->
prints HB
prints (i < idx)? -> LC -> LR ++ `\n`
prints (i < idx)? -> LC -> LR ++ '\n'
]
]

Expand Down
2 changes: 1 addition & 1 deletion examples/rosetta/move-to-front algorithm.art
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

symbolTable: @`a`..`z`
symbolTable: @'a'..'z'

encodeWord: function [s][
symt: new symbolTable
Expand Down
2 changes: 1 addition & 1 deletion examples/rosetta/n-queens problem.art
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ loop result 'solution [
loop solution 'col [

line: repeat "-" BoardSize
line\[col-1]: `Q`
line\[col-1]: 'Q'
print line
]
print ""
Expand Down
6 changes: 3 additions & 3 deletions examples/rosetta/password generator.art
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
lowercase: `a`..`z`
uppercase: `A`..`Z`
digits: `0`..`9`
lowercase: 'a'..'z'
uppercase: 'A'..'Z'
digits: '0'..'9'
other: map split "!\"#$%&'()*+,-./:;<=>?@[]^_{|}~" => [to :char]

any: lowercase ++ uppercase ++ digits ++ other
Expand Down
6 changes: 3 additions & 3 deletions examples/rosetta/permutations with repetitions.art
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
decide: function [pc]->
and? pc\0 = `B`
pc\1 = `C`
and? pc\0 = 'B'
pc\1 = 'C'

permutation: function [vals, n][
k: size vals
pn: array.of:n 0
p: array.of:n `0`
p: array.of:n '0'

while [true][
loop.with:'i pn 'x -> p\[i]: vals\[x]
Expand Down
10 changes: 5 additions & 5 deletions examples/rosetta/playing cards.art
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ranks: 1..13
suits: [`♣`, `♦`, `♥`, `♠`]
suits: ['♣', '♦', '♥', '♠']

define :card [rank, suit][
init: [
Expand All @@ -11,10 +11,10 @@ define :card [rank, suit][
print: [
R: ø
case [this\rank=]
when? [1] -> R: `A`
when? [11]-> R: `J`
when? [12]-> R: `Q`
when? [13]-> R: `K`
when? [1] -> R: 'A'
when? [11]-> R: 'J'
when? [12]-> R: 'Q'
when? [13]-> R: 'K'
else -> R: this\rank
~{|R||this\suit|}
]
Expand Down
2 changes: 1 addition & 1 deletion examples/rosetta/rhonda numbers.art
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
digs: (@`0`..`9`) ++ @`A`..`Z`
digs: (@'0'..'9') ++ @'A'..'Z'
toBase: function [n,base][
join map digits.base:base n 'x -> digs\[x]
]
Expand Down
4 changes: 2 additions & 2 deletions examples/rosetta/rot-13.art
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
rot13: function [c][
case [in? lower c]
when? -> `a`..`m` -> return to :char (to :integer c) + 13
when? -> `n`..`z` -> return to :char (to :integer c) - 13
when? -> 'a'..'m' -> return to :char (to :integer c) + 13
when? -> 'n'..'z' -> return to :char (to :integer c) - 13
else -> return c
]

Expand Down
2 changes: 1 addition & 1 deletion examples/rosetta/search a list of records.art
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ print last find records $[c][equal? c\name "Dar Es Salaam"]
print get first find records $[c][less? c\population 5] 'name

; Print the population of the first city starting with 'A'.
print get first find records $[c][equal? first c\name `A`] 'population
print get first find records $[c][equal? first c\name 'A'] 'population

6 changes: 3 additions & 3 deletions examples/rosetta/sedols.art
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ord0: to :integer `0`
ord7: to :integer `7`
ord0: to :integer '0'
ord7: to :integer '7'
c2v: function [c][
ordC: to :integer c
if? c < `A` -> return ordC - ord0
if? c < 'A' -> return ordC - ord0
else -> return ordC - ord7
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ multiReplace: function [str, rules][
]

print multiReplace "abracadabra" #[
a: [[0 `A`][1 `B`][3 `C`][4 `D`]]
b: [[0 `E`]]
r: [[1 `F`]]
a: [[0 'A'][1 'B'][3 'C'][4 'D']]
b: [[0 'E']]
r: [[1 'F']]
]
4 changes: 2 additions & 2 deletions examples/rosetta/set right-adjacent bits.art
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ setBits: function [inp, n][
else [
result: split inp
loop 0..e-1 'i [
if inp\[i] = `1` [
if inp\[i] = '1' [
j: i + 1
while [and? j =< i+n j < e][
result\[j]: `1`
result\[j]: '1'
j: j + 1
]
]
Expand Down
22 changes: 11 additions & 11 deletions examples/rosetta/soundex.art
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
code: #[
"aeiouy": `W`
"bfpv": `1`
"cgjkqsxz": `2`
"dt": `3`
"l": `4`
"mn": `5`
"r": `6`
"aeiouy": 'W'
"bfpv": '1'
"cgjkqsxz": '2'
"dt": '3'
"l": '4'
"mn": '5'
"r": '6'
]

getCode: function [ch][
loop keys code 'k [
if contains? k lower to :string ch -> return code\[k]
]
return ` `
return ' '
]

soundex: function [str][
Expand All @@ -21,8 +21,8 @@ soundex: function [str][
prev: getCode first str
loop.with:'i str 'c [
curr: getCode c
if curr <> ` ` [
if and? curr <> `W`
if curr <> ' ' [
if and? curr <> 'W'
curr <> prev -> 'result ++ curr
prev: curr
]
Expand All @@ -32,7 +32,7 @@ soundex: function [str][
result: slice result 0 3
else [
do.times: 4-size result ->
'result ++ `0`
'result ++ '0'
]
return result
]
Expand Down
2 changes: 1 addition & 1 deletion examples/rosetta/totient function.art
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ loop 1..100000 'i [
t: totient i
prime?: 1 = i - t
if i < 26 [
prints ~« Φ(|pad.with:`0` to :string i 2|) = |pad to :string t 2|
prints ~« Φ(|pad.with:'0' to :string i 2|) = |pad to :string t 2|
if prime? -> prints ", prime"
print ""
]
Expand Down
2 changes: 1 addition & 1 deletion examples/rosetta/unicode strings.art
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ text: "你好"
print ["text:" text]
print ["length:" size text]
print ["contains string '好'?:" contains? text "好"]
print ["contains character '平'?:" contains? text `平`]
print ["contains character '平'?:" contains? text '平']
print ["text as ascii:" as.ascii text]
2 changes: 1 addition & 1 deletion examples/rosetta/unprimeable numbers.art
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ unprimeable?: function [n][
if prime? n -> return false
nd: to :string n
loop.with:'i nd 'prevDigit [
loop `0`..`9` 'newDigit [
loop '0'..'9' 'newDigit [
if newDigit <> prevDigit [
nd\[i]: newDigit
if prime? to :integer nd -> return false
Expand Down
Loading