audio:// ? I've ported my PM-101 synth to Red and would like to hear it :)reactor: func [spec] [make reactor! spec] f: does [ prin "START..." loop 10 [a/x: 1 + a/x] print "FINISH" ] a: reactor [x: 0 n: is [[0] x n + 1]] b: reactor [x: 0] ? a/n react/later [ b/x f ] react/later [print ["a/x =" a/x "a/n =" a/n]] b/x: 1 f
START...FINISH a/x = 10 a/n = 0 a/x = 10 a/n = 1 START...a/x = 11 a/n = 2 a/x = 11 a/n = 2 a/x = 12 a/n = 3 a/x = 12 a/n = 3 a/x = 13 a/n = 4 a/x = 13 a/n = 4 a/x = 14 a/n = 5 a/x = 14 a/n = 5 a/x = 15 a/n = 6 a/x = 15 a/n = 6 a/x = 16 a/n = 7 a/x = 16 a/n = 7 a/x = 17 a/n = 8 a/x = 17 a/n = 8 a/x = 18 a/n = 9 a/x = 18 a/n = 9 a/x = 19 a/n = 10 a/x = 19 a/n = 10 a/x = 20 a/n = 11 a/x = 20 a/n = 11 FINISH
pixel-position, string-length, inner-count
position-pixel, length-string, count-inner
position-pixel and count-inner in particular sound like actions to take "position the pixel", "count the inner things"starting-time seems pretty obvious.start-time position is usually inferred by the context. However, if you were handling colours of individual pixels, it would seem to make sense to me to use pixel-pos and pixel-colour.pixel-position and position-pixel. To me, the first suggests a co-ordinate value, the second suggests a function value. Similarly for inner-count and count-inner. pixel-position looks like a pixel/position (where pixel is a map, an object or something like this). Is the position (or the pixel-position) a function or some value? I don't know. What matters for me it gives me some kind of value (in this case I would expect pair!).func. Now I use function in "more serious" codes. It cover more cases automatically than normal func.https://en.wikipedia.org/wiki/Naming_conventions_(programming\)#Hungarian_notation for parse's rules (no path syntax allowed there) but I don't find it very good..value from value one being the parsed value and the other the actual value you want to extract or process in your function or object.[copy .digits some =digit=] (digits: to-integer .digits) much easier to see, since it's obvious the .digits was the matched text.& + ~ in the past for disambiguation of word usage in many different contexts... parsing, xml transformation, EDI message handling, etc._rule was ok. I want to use such system but I don't know which symbols to use. There is a problem with infix vs prefix vs outfix notations as well. =newline= =newline?= =newlines= =newlines?= =not-newline= =not-newline?= =not-newlines= =not-newlines?= !new-line! this last rule is a standardized decoration for a look-ahead assertion that there is new-line, without consuming it.=word= because it looks like a label on a jar. :smile: = to the end of words for rules, because it looks a bit like BNF production rule syntax, and to add = to the beginning of values set by parse, because it mirrors the rule...rule and then also mimics set-word/get-word syntax. funcs [ "test funcs" a [ dir! ; a user defined pseudo-type, which has to pass an identity function verification string! [some ["a" | "b"]] ; block after a type is a parser issue! (a: to-file a) ; paren after a type is executed ] "test args" ; standard doc string. b [ integer! string! (integer? attempt [b: to-integer b]); expressions must return truthy value ] c [integer! float!] (c > 4) "blah" ; expression is valid for both types. ][ ?? a ?? b ?? c ]
parse data [some mytype!] , and stuff like mytype? , to-mytypeas well as being useable directly within the 'FUNCS function builder abovefuncs [
data [block! [some [integer! | float]]]
][
counter: 0
foreach value data [ add counter value]
]integer! or float! values inside it will raise an error about inputs being wrong, before even starting the loop. also note that in this case we do not accept empty blocks!url! for detailed documentation/skip implies some sort of "spatiality", as if you work with series and need to skip N elements./omit is still the best choice.funcs is a local by default builder, like function in Red. maybe if I add set-word! values in the spec (it seems like a natural fit for refinement args) it would make senseparen around those examples and you've got the same idea paren!makes more sense, right'word and :word respectively), integration with dialects (e.g. I'd like function's body to be evaluated with math), some support for logging and tracing.def foo(term) when is_integer(term), do: term def foo(term) when is_float(term), do: round(term)
foo: dispatcher [term] dispatch :foo [integer? term][term] dispatch :foo [float? term][round term]
funcs for runtime function building and #funcs as a macro to relay the extra work to the preprocessor. The former is more useful when working in console, the latter when you need faster code.charset [...] in body, I don't actually create a bitset! value, but defer its creation to function's runtime. But with e.g. #inline charset [...] this expression will be evaluated at function's creation time and yield the value as-is./refinement a [integer! 5] b ["default"]. A block will contain types and a default value. bind's name but it's similar thing). If I (or someone else) can figure out how to rewrite functions so that they won't contain another recursive calls then only limitation is the type (e.g. I was able to calculate 1476th (or 1477th with different starting position) Fibonacci number using float!- when I tried 1477 I got infinity (1.#INF to be precise)). fib: func [n] [
either n < 2 [
return n
] [
return ( (fib (n - 2) ) + (fib (n - 1) ) )
]
]
mfib: memoize :fib
mfib 30.0>> mfib 1000.0 *** Internal Error: stack overflow *** Where: fib *** Stack: mfib fib fib fib fib fib fib fib fib fib fib fib fib fib fib fib fib fib fib fib fib fib fib fib fib fib fib fib fib fib fib fib fib fib fib fib fib fib
memoize as I do not have good enough pc to run it smoothly. I assumed bind without really looking at the error. Again I am sorry for the confusion.bind is in any way related to stack overflow, which, in fact, happens because Red has no tail-call optimization. Depth of one recursive call exceeds stack limit (which is expected with such large numbers), so you should rather build it up gradually, e.g.:do https://raw.githubusercontent.com/9214/whatnot/master/red/memoize.red
fib: memoize func [n][
either n < 2 [n][
add fib n - 2 fib n - 1
]
]
boost: does [
foreach x [100.0 400.0 700.0][fib x]
]
boost
probe fib 1000.0[100.0 400.0 700.0]) in your case. Sure, we can compute what is an argument for Fibonacci (or Fibonacci n-step number sequences in general) but:[100.0 400.0 700.0]) in your case. Sure, we can compute what is an argument for Fibonacci (or Fibonacci n-step number sequences in general) but:block-of-numbers! type, then you can automatically convert any viable values to a number in your type's make function and coerce it on the fly on a function call. it will validate if the given data CAN be viable once coerced, if it the given data isn't currently viable.pass-muster and I've tinkered with a variant I call vet for Red.sum: FUNCS [values [numbers!]][ total: 0 foreach value values [total: total + value] total ] result: sum [1 2.0 1:00 none] ?? result == result: 3603.0
integer! float time! none paren! word!types and attempts to reduce and convert everything it can.sum ["aaa" 1 2]
== make object! [
code: 800
type: 'user
id: 'message
arg1: {given 'VALUES data doesn't comply to required format for NUMBERS! pseudo-type}
arg2: none
arg3: none
near: none
where: 'do
stack: 38531744
]try trap).numbers! is very explicit, and would *not* support none or word values. That is, it will not keep you from producing bad data, because it is more forgiving. It is not more explicit if those details are hidden somewhere else.numbers-and-some-random-stuff! would seem more appropriate, I guess.numbers! in your own code, so this level of detail is up to you. just like any function you write. I'm just giving the toolkit to allow you to use your own types numbers! in @moliad's funcs is no different than what Red can do today:>> some-stuff!: make typeset! [word! string! float! none!] == make typeset! [none! string! float! word!] >> f: func [x [some-stuff!]][x] == func [x [some-stuff!]][x] >> f "a" == "a" >> f 3.14 == 3.14 >> f 3 *** Script Error: f does not allow integer! for its x argument *** Where: f *** Stack: f
dependent-type!! syntax. ;^)pair! values as index keys, but they have a few specific constant keys that cannot be used ... so I can always verify with a keys! type that these are never supplied. it's a uniform concept in the whole database engine... it will be much more explicit than saying block!.... which could be filled with anything, not just keys.parse, maybe specific ones for different contexts. parse which includes a function callback signature, it certainly goes deeper. Being somewhat newer to the language family, it was surprising (not in a confusing, but more "oh, cool!" way), and feels like a really natural progression of growing into the language features. Not needing to know all the details at first, but discovering that there is more power there. @moliad's extension of this sounds really nice to me so farfunction spec)block! ! so you could uniformise your data to two different types of data (block of integer! block of pair! ) and make sure you get just one or just the other and possibly use two different accumulation mechanism. integer!, a float! and a string!. I want to convert everything to an integer!:integer! -> no changefloat! -> call to-integerstring! -> some parse code object! with 2 functions(is? + make) and a name. All the rest is done in the FUNCS builder (which also just inserts code in the function body).to-yourtype and yourtype?... yourtype! also becomes usable within FUNCSyourtype/make and validity is managed by yourtype/is? from within the FUNCS . The interesting bit I added late yesterday is that is? now can return 'coerce. This means we can know if given data is a direct match for our type OR if it is valid only after yourtype/make. with this information, FUNCS will apply coercion or not.guardset!git checkout filename.adoc to delete changes. Can I somehow prohibit changes for some files/directories? I want this feature to be easily turnable (e.g. if I want to push quick fix for doc from other language: I turn this feature off, commit changes, turn it on again).pl folder, if you put some files into it then probably it will show it as pl.readonly to prevent any edit attempt? I don't think there is a way to do it in Git.plreadonly attribute for all people after I create pull request? And I see some files are readonly... I don't want to mess up.docs in your editor of choice, you can make a pl folder and then copy everything from inside the en folder. git add files individually, the files that you haven’t translated yet won’t get pushed to your fork. git add . or it will stage all files for pushing and you’ll have a mess on your hands. git add filename.ext) might be good however copying everything from en might be confusing as I won't know what I need to translate and what I don't need to translate.draw we have the commands needed, and draw-to-ascii could be an interesting experiment.node and connect, each having appropriate description of attributes in dialect, which would translate into VID base faces with corresponding attributes. Something likeview diagram [
below center
think: node "Think of the problem"
connect arrow
node "Experiment"
connect arrow
node diamond "Clear?"
connect arrow to think "No"
connect arrow "Yes"
node "Implement"
]think the path has to be computed, which may become a highly complicated problem in itself if we try to produce nice diagrams. But easier way is to provide description of path (at least partly), e.g. connect arrow to think "No" path [horizontal -50]. Here path is given ony the first segment of snakeline, the rest of it is easy to infer. But path may also be quite complicated (as snake example in [article](https://github.com/toomasv/article)).view [panel black [origin 1x1 space 1x1 style c: text wrap center white 50x32 c bold "Row 1" c "Cell 1.2" c "Cell 1.3" c "Longer text" return c bold "Row 2" c "Cell 2.2" c "Cell 2.3" c "Cell 2.4" ]]
; Longer fourth column
view [panel black [origin 1x1 space 1x1
style c: text wrap center white 50x16 style c4: c 80x16
c bold "Row 1" c "Cell 1.2" c "Cell 1.3" c4 "Longer text" return
c bold "Row 2" c "Cell 2.2" c "Cell 2.3" c4 "Cell 2.4"
]]
;Higher first row
view [panel black [origin 1x1 space 1x1
style c: text wrap center white 50x16 style r1: c 50x32
r1 bold "Row 1" r1 "Cell 1.2" r1 "Cell 1.3" r1 "Longer text"
return c bold "Row 2" c "Cell 2.2" c "Cell 2.3" c "Cell 2.4"
]]list style, which used its iterator concept for virtual faces. The layout spec you gave it was for a "row" in the list, which would be created on demand as items scrolled into view.view dia [ diagram "Diagram example" [ pad 60x0 node ellipse water font [color: white style: [bold italic] size: 12] "One" return node "Two" node diamond 60x50 "Three" return pad 60x0 node box 50x30 "Four" node "Five" return pad 250x-250 n6: node ellipse 40x40 "Six" connect data [node1 node2] connect data [node1 node3] connect data [node3 node4] connect data [node3 node5] connect data [node5 n6] ] ]
ast may be developed further.view dia [
diagram vertical beige 200 "Problem workout" [
space 20x20
origin 80x10
below
node {Think about^/the problem}
node "Experiment"
node diamond "Clear?"
node "Implement"
connect node1 node2
connect node2 node3
connect node3 node1 hint [horizontal 60] pen red
connect node3 node4 pen leaf
]
]set-word! support, to name nodes.below organizes nodes, vertical/horizontal does that for connections. vertical just after diagram sets default direction for connections. Set-word is there from the beginning, as e.g. in first example n6.connects in the end and cannot insert these between nodes. Otherwise some connection-lines will remain visible above nodes (they run from centers to centers). I hope to get rid of this limitation.view probe dia [
below
diagram vertical beige "Diagram example" [
space 40x40
pad 60x0
node ellipse water font [color: white style: [bold italic] size: 12] "One"
return
node "Two"
node diamond 60x50 "Three"
return
pad 75x0 node box 50x30 "Four"
node "Five"
return
pad 250x-250 n6: node ellipse 40x40
border [line-width: 5 pen: gold] font-color red "Six"
connect node1 node2 arrow closed
connect node1 node3 arrow closed
connect node3 node4 double
connect node3 node5 double line-width 2
connect node5 n6 hint [horizontal] line-width 2 pen brick arrow
]
pad 0x40
diagram border [pen: 'gray] "Problem workout" linen [
style step: node border gray font-color black
style chk: node diamond border gray font-color black
space 20x20
origin 40x10
think: step {Think about^/the problem}
below step "Experiment"
across chk "Clear?"
pad -200x0 step "Implement"
connect node1 node2 line-width 3 pen gray arrow
connect node2 node3 hint [vertical 40] line-width 3 pen gray arrow
connect node3 think hint [vertical 40 -160] line-width 3 pen red arrow
connect node3 node4 line-width 3 pen leaf arrow
]
]link in place of connect, but you may want to add a link facet for URLs when clicking on a node. link! I didn't think of it yet. Any more suggestions?load a url like this:>> j: load https://httpbin.org/get
== #(
"args" #()
"headers" #(
"Accept" "*/*"
"Con...>> j/("url")
== "https://httpbin.org/get"select, which is a little nicer:>> select j "url" == "https://httpbin.org/get"
Accept: */* would be a valid path!, but maybe that case would be better to keep as a string!load may not always produce the type you want. So we'll likely use a schema application step, where you can define the target types and run the raw result through that.Map! was changed to support none values, so they wouldn't just disappear. They will now properly round trip. We don't want a lossy codec.find as with blocks. This allows path access to return none and gives you a way to tell if a key is there or not.json-schemas: #(
https://httpbin.org/get #(
origin: [collect [any [keep tuple! | skip]]]
url: url!
)
)path!, like the 'content-type' or ones that would load as word!might also be awkward to work with. I don't think that quite makes it wrong, but I sort of questioned it.load in a schema scenario, but to, because the user is telling us what type they want. *However*, we can provide an example loader, and we should. People new to Red won't know the power of datatypes to start, and this will clue them in.files: read %.
texts: copy []
foreach file files [
modified: query file
append texts reduce [
mold file
modified/date
rejoin [modified/hour ":" modified/minute]
]
]
table/tight/colors/th [[] [center] [right]] append [
[gray white bold "File"] [gray white bold "Date"] [gray white bold "Time"]
] texts [silver white]table/tight [[beige][][right]][
"2000" "This year we just started" "3.00"
"2010" "Some real income" "60'000.00"
"2020" "Now we are talking" [red white bold "900'000.00"]
]table source?text-table renders only visible lines so huge amount of data isn’t problem, probably you can do something similar.text-table then, if I'm going to make it for bigger data. But I knew your text-table is powerful, so I didn't try to do something comparable, but a small thing, 100 LOC.text-table.effect pipeline, edge facet, etc. and that made each face much more work to render. text-table.view dia [ style cell: node box 50x20 0 diagram [ below origin 0x0 space 0x-1 t1k1: cell "key1" t1k2: cell "key2" cell "field1" cell "field2" cell "field3" ] pad 30x30 diagram [ below origin 0x0 space 0x-1 t2k1: cell "key1" cell "key2" cell "field1" cell "field2" cell "field3" ] pad 30x-20 diagram [ below origin 0x0 space 0x-1 t3k1: cell bold "primary" cell "field1" cell "field2" cell "field3" ] connect arrow from :t1k2 to :t2k1 connect arrow from :t1k1 to :t3k1 hint 75 ]
munge. read would be much slower than text-table rendering.[parse vid draw math].view dia [ space 50x20 fld: field focus on-enter [append list/data face/text] connect arrow label start "<Enter>" list: text-list data [] connect arrow label [mid right] "<Press>" button "Check" [ chk/data: (last list/data) = chk/text ] return connect arrow hint vertical to right chk: check "Amazing?" ]
{\u0027Spiky moss\u0027} into {'Spiky moss'}?\nunescape, with refinements, or args, for more precise control?drag and wheel keywords to diagram style to turn diagrams easily into dragable/wheelable. Two examples:diagram style.title: :ticket: Any special reason? :smile:view [
do [
mid-offset: none
]
base all-over
on-mid-down [mid-offset: event/offset]
on-over [
if mid-offset [
change-offset: event/offset - mid-offset
probe change-offset
]
]
on-mid-up [mid-offset: none]
]drag-on option for dragging. The kind of thing you propose I have used for drawing, but to drag things around with middle button, the easy way isview [size 100x100 base options [drag-on: mid-down]]
on-click (only button does), and I have to think of better usage for on-down (it's currently waiting for url address for link).loose face or dragging with drag keyword on diagram style? In latter case the original offset is 0x0. To put it back to 0x0 is possible, but a bit convoluted. Like e.g. here:view dia [
style ring: node ellipse 30x30
diagram 70 drag beige with [
append body-of :actors/on-up bind [
face/offset: 0x0 show face
] :actors/on-up][
ring connect pad 50x0 ring
]
]loose faces you can use menu, as e.g. here:view dia [
size 200x200
node "Hi" loose with [
menu: ["Record pos" record "Restore pos" restore]
]
on-menu [
switch event/picked [
record [pos: face/offset]
restore [face/offset: pos]
] ] ]diagram. Should be possible to use with drag also, I didn't try yet.drag-on option for dragging. The kind of thing you propose I have used for drawing, but to drag things around with middle button, the easy way is> view [size 100x100 base options [drag-on: mid-down]] >
table style. It's not a native widget we can wrap that will work consistently on all platforms. It's a biiiigggg task. But we can start with simple things and experiment. Just be aware that it may change.r.g.b value like 1.1.1 and you add 999.0.0, Green & Blue shouldn't changed (they should still have 1 & 1 value)..data section.RED?he- = adjectiveo no i na a hama e hamaa hama o no e hama i nai mama e hee he i mamabluetoothctl, hcitool, hcidump, btmon, and tcpdump aren't working reliably to detect the presence / absence of a device.tcpdump is pretty reliable, but it requires that their WiFi is turned on and we have 4 different WiFi networks here for different roles at the company. That means I'd have to figure out how to listen on all 4 WiFi networks.??? function????: func[a [pair!] b [pair!]][ not any [a/x > b/x a/y > b/y] ]
>> ??? 1x1 2x2 == true >> ??? 1x3 2x2 == false
within? ?>> 1x1 < 2x2 == true >> 3x1 < 2x2 == true
>> 3x1 < 2x2 == false >> 1x3 < 2x2 == true ;<---- not correct answer for my use case
within?function for that:>> help within?
USAGE:
WITHIN? point offset size
DESCRIPTION:
Return TRUE if the point is within the rectangle bounds.
WITHIN? is a function value.
ARGUMENTS:
point -- XY position (Type: pair)
offset -- Offset of area (Type: pair)
size -- Size of area (Type: pair)sort/compare provided with func [a b][ a > b] must have been changed during the last week with the effect of reversed logic. Can someone confirm this?sort is now fixed, yes.Rcpp package which is a way to use the C API in a simpler way. Also, R is a Lisp-like language as julia is (but not Python, Ruby,…)./help on [30th August](https://gitter.im/red/help?at=5d695ad6375cc34fdee7279f). This particular message that I referenced, before the edit, was written as follows (@BeardPower can confirm, as he saw it) ([example](https://gitter.im/red/help?at=5da8f6eb89acff6ff5147fc6)) - kinda the same like @TimeSeriesLord's SO answer referenced above. /GTK room, about "slow pace of Red development, Rebol's and Carl's superiority, Red should've implemented GTK backend before releasing Windows and macOS ones, yada-yada", to which @rebolek responded with [this](https://gitter.im/red/GTK?at=5d9f6c685173c33ca1a19617) and me with [this](https://gitter.im/red/GTK?at=5d9f738d0e67130aae4c09b7); after that, @SmackMacDougal personally insulted me, refuted @rebolek's point with the same passive-aggressive tone, and deleted both messages. I reported this to @greggirwin./help, lashing out on another community member on the verge of swearing), so be it. I know I can be problematic at times, but that's simply too much to put up with. Go find yourselves another whipping boy.R which is maybe normal since it is difficult to invest on all languages. Every R users know that for loop is not well suited. So comparing R language with other languages based on (interpreted even byte-compiled) loop is of course not fair at all. And as a note, I am in the R (French) community the guy who claims for long that Julia (and not Python) is really the next language at least for statistical computing. red and also on any other technical topics.replace i [4 2 3] [4 2 9] should work. Something like forall i [if all [i/1 = 4 i/2 = 2][i/3: 9] i: skip i 2] is another way.parse. The best choice depends on your exact needs.>> i: [1 2 3 4 2 3 5 2 3] change skip find/skip i [4 2 3] 3 2 9 i == [1 2 3 4 2 9 5 2 3]
mychange: func [series [series!] what [series!] where [integer!] value][
change at find/skip series what length? what where value
]
>> i
== [1 2 3 4 2 9 5 2 3]
>> mychange i [4 2 9] 3 3 i
== [1 2 3 4 2 3 5 2 3]
>> mychange i [4 2 3] 2 4 i
== [1 2 3 4 4 3 5 2 3]
>> mychange i [4 4 3] 2 [2 9] i
== [1 2 3 4 2 9 5 2 3]- between words in your function names for readabilitytrim replace/all s1 " " "" can be trim/all s1 (note that both work in place, not on a copy)trim replace/all s1 " " "" in your foreach do nothingatomexists? as not none? find/skip db reduce [s1 p1 v1] 3append db reduce is repend dbreturn x at the end of the function can be just xforeach [sub pred val] parse find/skip is shorter and works faster.insertatom function could work incorrectly since you use forall, it doesn't treat db as records:>> db: [1 2 3 2 0] >> s1: 1 p1: 2 v1: 1 >> forall db [if all [db/1 = s1 db/2 = p1][db/3: v1]] >> db == [1 2 1 2 1]
foreach [sub pred val] "parse" -> "parts" >> f: func [one two /rr three] [print "three ->" three] >> f 1 2 /rr 3
f [server-name <value> connection-string <value>]
>> f: func [one two /rr three] [print ["three -> " three]] == func [one two /rr three][print ["three -> " three]] >> f/rr 1 2 3 three -> 3
f: func [one two ref three /use] [
either use [
do reduce [one three two]
][
do compose [(to-path reduce ['f to-word ref]) one two ref three]
]
]
>> f 1 2 /use '+
== 3
>> f 1 2 /use '*
== 2
>> f 1 2 /use '**
== 1op: "+-*/%" surprise: func [a b][o: get to-word random/only op a o b] loop 10 [prin rejoin [surprise 2 3 " "]] ;2 -1 -1 -1 2 5 5 0 5 5
context word and load/do, something eye opening but I am not finding them>> context [res: none set 'is added to make op! func [a b][res: add a b print "OK."] set 'What is the result? does [res]]
== make object! [
res: none
]
>> 1 is added to 3
OK.
>> What is the result?
== 4op!, and... The road to Hell is paved with this kind of thing. ;^)system/lexer/pre-load: func [src][ ws: charset reduce [space tab newline] ws+: [some ws] dig: charset "0123456789" num: [some dig] parse src [any [ "myfunc" s: ws+ 2 [num ws+] any [i: ["/r3" | "/r4"] ws+ num ws+ ( move/part i s 3 s: skip s 3 )] | skip]] ] myfunc: func [one two /r3 three /r4 four][ case/all [ r3 [print ["three ->" three]] r4 [print ["four ->" four]] true [print ["args ->" one two]] ] ]
>> myfunc 1 2 /r3 3 three -> 3 args -> 1 2 >> myfunc 1 2 /r3 3 /r4 4 three -> 3 four -> 4 args -> 1 2 >> myfunc 1 2 args -> 1 2
. in PHP, spaced and unspaced in Ren-C etc...append copy, the rest is a mezzanine code to handle all the types. .org is sold to a company:.org is sold to a company:mold/all, which has to be done for every type, meaning design decisions on serialized syntax.about gives the info, but it can't be parsed. try something that doesn't work in red, then set a variable :) rebol is defined in Rebol :)print [split form os-info newline]either rebol [print "rebol"][print "red"]saveit: does [ either rebol [ save/all %db.txt db ][ dbsave: to-block db save %db.txt dbsave dbsave: copy [] ] ]
loadit: does [ either rebol [ either not exists? %db.txt [ db: to-hash [] ][ db: load %db.txt ] ][ either not exists? %db.txt [ db: to-hash [] ][ db: load %db.txt db: to-hash db ] ] ]
clear instead of copying empty blockdbsave: to-block db save %db.txt dbsave dbsave: copy []
save %db.txt to-block db
Red [] Rebol [] ;db names and paths, creates blank or loads existing. data: [dbs %dbs.txt red %red.txt] loadit: does [ foreach [name path] data [ either not exists? path [ set :name name: to-hash [] ][ either rebol [ set :name name: load path] [ set :name name: to-hash load path ] ] ] ] saveit: does [ foreach [name path] reduce data [ either rebol [ save/all path name ][ save path to-block name ] ] ]
set :name name: looks really strange? You can reduce it to just:set :name load path
reduce data, instead use:saveit: does [
foreach [name path] data [
either rebol [
save/all path get name
][
save path to-block get name
]
]
]saveit: has [db][
foreach [name path] data [
db: get name
unless rebol [db: to block! db]
save/all path db
]
]set :name name: looks really strange? blah: func[][...] think this is an assignment for a blah variable to a declaration of a function, but it's really just a bunch of values and blocksselect used as a full access mechanism for blocks seen and manipulated as tables, developers must be able to project their ideas realized through Red in their respective inner projection wall. If this happens he will come onboard. Also, another mechanism letting him dream that our language gives: time, simplicity, access to new tecnology, they are all drivers for the adoption of Red. Also leaders are important. Carl attracted me thanks to having been innovative with amiga, so I thought its language should be innovative too. atomica. Atomica can be used for personal use , but will also contain the info to drive Atomica itself. So, instead of a data file with dbs and paths, in the future, the way to create a new db will be as simple as adding a triple to the default atmoica db like this. insertatoms "mynewdb" "isa" "atomicadb" insertatom "bob" "email" "bob@example.com" "mynewdb" theemail: singlevalue "bob" "email" "mynewdb" \>> "bob@example.com
persons: vofsandp "Donald Trump" "has associate" would return a list of subjects. From that list you could say find out which are lawyers, or over 55, or lawyers and over 55. 'foreach person persons [print sofpandv "isa" "lawyer"]insertatom "uid093" "is" "gitterpost" insertatoms "uid093" "hasentity" "usability" insertatoms "uid093" "hasentity" "feedback" insertatoms "uid093" "hasentity" "bugreports" insertatoms "uid093" "author" "Gregg"
"bob" "is a" "person" "person" "is a " "human" "is a" "is a" "predicate" So when you see a subject as a value, how do we know it's also a subject? Even the system doesn't know unless it checks. x: value-of-subject-and-predicate "bob" "haspet"saveit probably not improved much save-it but ask any 10 people what vofsandp might be vrs v-of-s-and-p vsp: v-of-s-and-p: :vofsandpatom is the smallest unit of language that can be created. It's composed of a single subject, predicate and value (object)get-all-the-values-when-you-know-the-subject-and-the-predicate"haspet" or "potus". Which may be fine for @LFReD when he writes it, but requires some mental processing from readers what it really is. And @LFReD should also know, that "haspet" will consume same amount of memory like human friendly "has pet".是一个 as a predicate, are you going to tell them no? (That's "is a" in Chinese)sobject: func [s1][ out: [] foreach [s2 p1 v1] atomica [ if s1 = s2 [ append out reduce [to-word p1 v1] ] ] ]
sobject: func [s1][
out: copy []
foreach [s2 p1 v1] atomica [
if s1 = s2 [
repend out [to word! p1 v1]
]
]
]? rependappend out reduce will be faster. Still, in your code you have double line breaks, which is confusing. And missing copy, which is a serious bug.repend is slower than append reduce https://github.com/red/red/issues/3340#issuecomment-547436501repend is slower, because it is not a native, so it is not too interesting. Maybe I should just fix note instead of not in my previous message.reduce/into is so slow and why the issue is closed.reduce/into ['a 'b] tail b to have it same as repend with good speed.remove-each for: O(n^2) asymptotic complexity.get openport! is in nightly but no info on how to use them?map! on Youtube "Red-lang map" compare that with "python map".Q [H "cat" H "possess" H "number"][O "I know, and they use every one."]load and do code, updating those externally is easy as well. at code instead.halt option, which is crude, but being able to drop into a console, with the current state in tact, could be very handy.true: false or false: true. One crashes, the other works fine and... Does some fun stuff.