by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 13:04
    dockimbel assigned #650
  • 13:00
    dockimbel milestoned #4574
  • 13:00
    dockimbel labeled #4574
  • 13:00
    dockimbel labeled #4574
  • 13:00
    dockimbel labeled #4574
  • 13:00

    dockimbel on master

    FIX: issue #4574 (Remainder rai… TESTS: extend FLOAT! test suite… Merge pull request #4599 from 9… (compare)

  • 13:00
    dockimbel closed #4599
  • 13:00
    dockimbel closed #4574
  • 12:59
    dockimbel unlabeled #734
  • 12:58
    dockimbel labeled #734
  • 12:58
    dockimbel labeled #734
  • 12:58
    dockimbel labeled #734
  • 12:58

    dockimbel on master

    FIX: issue #734 (lit-word varia… TESTS: add regression test for … Merge pull request #4600 from 9… (compare)

  • 12:58
    dockimbel closed #4600
  • 12:58
    dockimbel closed #734
  • 11:38
    Travis red/red#4218 errored (5266)
  • 11:07
    loziniak commented #4218
  • 11:00
    loziniak synchronize #4218
  • 10:08
    Travis red/red (master) passed (5265)
  • 09:40
    Travis red/red#4607 errored (5264)
Semseddin Moldibi
@endo64

So something needs more parsing to be considered a dialect?

Not exactly, for example, words inside the block given to view (or layout), they don't have any value in the Red's (global) context, button or box red 10x10 doesn't mean anything for Red interpreter. But view or layout function takes those words and values inside the block, and builds an object, generates an output or a new block that can be evaluated by Red (by do or other evaluators)

Of course Red is also a dialect of itself, that is another story :)
See these links to have a more insight:
http://www.rebol.com/r3/docs/concepts/parsing-dialects.html
http://www.codeconscious.com/rebol/dialects.html
X.A.N.O.Z.O.I.D.
@XANOZOID

REBlog is a prolog-dialect for REBOL

wowowowow. I am just learning but I really hope this language lives up to everything I hope it can

Semseddin Moldibi
@endo64

Here is an meaningless example of a dialect:

>> run: function [b] [parse b [any [t: ['left | 'right | 'up | 'down ] (print ["Go" first t])]]]
== func [b /local t][parse b [any [t: ['left | 'right | 'up | 'down] (print ["Go" first t])]]]
>> 
>> run [left up down]
Go left
Go up
Go down
== true

Here [left up down] is a dialect for run function.

For a meaningful example see source math :)
X.A.N.O.Z.O.I.D.
@XANOZOID
That's crazy . . . Smalltalk can do similar things, but not nearly as elegantly as that. Nowhere near as natural.
Petr Krenzelok
@pekr
Shouldn't such discussion be moved to Help or some other channel? :-)
Semseddin Moldibi
@endo64
Ah @pekr is right, I thought we are in help room. 🤦‍♂️
X.A.N.O.Z.O.I.D.
@XANOZOID
I wish Gitter was better for finding these things! I had to change the URL to find the channel list . . .
Boleslav Březovský
@rebolek
I've added moustache parser to castr so now you can use Moustache templating with Red CGI or with the Hub webserver (not directly yet, it needs some kind of module system first).
GiuseppeChillemi
@GiuseppeChillemi

REQ: Please, could you add /only to replace to support this coding pattern?

>> x: [foreach %values c [print %values]]
== [foreach %values c [print %values]]
>> z: [a b]
== [a b]
>> sss: [1 5 2 6 3 7]
== [1 5 2 6 3 7]
>> replace/deep/all x %values z  
== [foreach a b sss [print a b]] ; !!!
; !!!! It should be replace/deep/all/only
; !!!! The result should be: [foreach [a b] sss [print [a b]]
>>

(Note, the filetype, could be any usable type)

Adam Sherwood
@theSherwood
@rebolek Great work! I too am looking forward to a module system. Other than ports, a module system feels like the last significant barrier to Red being production ready.
Toomas Vooglaid
@toomasv
@GiuseppeChillemi Besides only, how did you get sss in your desired result?
Boleslav Březovský
@rebolek
@toomasv I belive @GiuseppeChillemi is just missing part of code there.
@GiuseppeChillemi write a proposal here https://github.com/red/rep , IMO it's a good idea.
@theSherwood thanks! By modules I actually meant just modules for the webserver, not full module system for Red. Which would be nice, of course, but is not required for this :)
GiuseppeChillemi
@GiuseppeChillemi
@toomasv maybe it because I have just woken up, but I don't get the question
Ok I have got it! I have edited the code and replaced C with SSS to avoid printing A B C but I have forgotten to do this in the first lines!
GiuseppeChillemi
@GiuseppeChillemi
This is the correct one:
>> x: [foreach %values SSS [print %values]]
== [foreach %values SSS [print %values]]
>> z: [a b]
== [a b]
>> SSS: [1 5 2 6 3 7]
== [1 5 2 6 3 7]
>> replace/deep/all x %values z  
== [foreach a b SSS [print a b]] ; !!!
; !!!! It should be replace/deep/all/only
; !!!! The result should be: [foreach [a b] SSS [print [a b]]
>>
Toomas Vooglaid
@toomasv
@GiuseppeChillemi Try this. I haven't tested it thoroughly, please report any errors you'll find.
x: [foreach %values SSS [print %values]]
z: [a b]
SSS: [1 5 2 6 3 7]
replace/only/deep/all x %values z
;== [foreach [a b] SSS [print [a b]]]
xqlab
@xqlab
You can achieve that not so elegantly with
>> replace/deep/all x %values reduce  [z]
== [foreach [a b] SSS [print [a b]]]
GiuseppeChillemi
@GiuseppeChillemi
@toomasv Thanks Toomas, I'll test it. My proposal is to make this /only standard in Red Replace.
GiuseppeChillemi
@GiuseppeChillemi
@xqlab Yes, no so elegant but it works!
GiuseppeChillemi
@GiuseppeChillemi
@toomasv I hate you Toomas!
In my ideas notebook I have written some notes about using parse rules to have an advanced find... Now I am looking a your code and I have discovered you have already implemented using parse rules in this replace!
GiuseppeChillemi
@GiuseppeChillemi
Great, but don't do this again... bad boy!!!
Boleslav Březovský
@rebolek
@GiuseppeChillemi have you actually checked the replace source?
GiuseppeChillemi
@GiuseppeChillemi
@toomasv no, just the specs! Is it something different?
Pardon.. @rebolek
Boleslav Březovský
@rebolek
@GiuseppeChillemi replace has been always parse based :)
(with /deep refinement)
GiuseppeChillemi
@GiuseppeChillemi
Coming from Rebol, I have not looked deeply because I thought it was the same, as replace is not mentioned here (but it should). Looking better, it I different in may ways.
Toomas Vooglaid
@toomasv
@GiuseppeChillemi I only added little bit to the already existing code of replace. If /only will be supported officially it will probably be something similar.
Boleslav Březovský
@rebolek
@toomasv as @dockimbel is now on request-merging spree, it would probably be worthturnng your Gist into proper merge request, what do you think?
Toomas Vooglaid
@toomasv
@rebolek Yes, good idea! Have you looked at it? Do you think it is ok?
Boleslav Březovský
@rebolek
@toomasv I've glanced over it, you just add a new brach for every insert right? If you want to be fancy, maybe you can use same trick as replace does with do-parse: pick [parse/case parse] case and the do compose every block where insert is, but I'm not sure it's worth it.
(if only we had apply ;) )
Michał
@the-man-with-a-golden-mind
Hello. I am trying to find something about Red performance...benchmarks etc. Do you know something about it?
Boleslav Březovský
@rebolek
@the-man-with-a-golden-mind Hi! What kind of benchmarks are you interested in? Comparing Red to what languages in what area?
Michał
@the-man-with-a-golden-mind
For example Python: Number processing, arrays, lists?
Boleslav Březovský
@rebolek
I see. I'm not aware of any benchamrks, do you have some links for Python? Then the benchmarks can be ported and we can do some comnparison. Anyway, Red is not optimized, so if we talk just about some math and looping, it would probably be slower.
Toomas Vooglaid
@toomasv

From what I have read on this topic in earlier posts, Red proper is generally comparable to other interpreted langs of similar level, but R/S is about 2-5 times slower than C due to being not optimized yet. On Red level there can also be large differences depending on how a specific function is implemented - is it compiled as just a high level sugar func or at R/S level. R/S level compiled code runs typically about two orders of magnitude faster than comparable Red level code.

Some relevant posts ordered by recency:
:point_up: ldci 2020-06-07
:point_up: greggirwin 2020-05-23
:point_up: dockimbel 2019-05-11
:point_up: dockimbel 2018-03-20
:point_up: dockimbel 2017-10-17
:point_up: dockimbel 2017-04-15

Michał
@the-man-with-a-golden-mind
2.5 times slower then C ...is still amazing. Is it save?
Toomas Vooglaid
@toomasv
I am no expert on this, so I'll let others to talk:
:point_up: 9214 2020-08-17
:point_up: greggirwin 2019-09-25
:point_up: 9214 2019-09-25
:point_up: dockimbel 2018-10-16
GiuseppeChillemi
@GiuseppeChillemi
@toomasv
Why not change instead of remove / insert? It ha /only refinement
head change/only find [a b c] 'c [x y z]
== [a b [x y z]]
Toomas Vooglaid
@toomasv
@GiuseppeChillemi I looked it over and there were several mistakes :flushed: I did also some changes according to @rebolek's suggestion.
Toomas Vooglaid
@toomasv
@GiuseppeChillemi Now changed according to your suggestion too.
GiuseppeChillemi
@GiuseppeChillemi
Great, I'll test it later
drpsy77
@drpsy77
Hi there, don't Know if I am in the right place. I want to get the selected text in an area, but in multi-lines content, the pointer x is shifted by the number of lines before the starting point of the selection. I think it's because the code that evaluates the positions also counts an escape symbol ^.
Toomas Vooglaid
@toomasv

@drpsy77 Are you using nightly builds? This problem was fixed some time ago. E.g. the following code works well with nightly builds:

pairs: clear {} 
tx: {one^/two^/three^/four^/five^/} 
beg: 1 
while [t: find tx newline][
    repend pairs rejoin [as-pair beg e: index? t newline] 
    beg: e + 1 tx: next t
]
tx: head tx
view [title "Test selection" 
    ar: area tx 
    panel [origin 0x0 below 
        button "Select" [r: f/selected ar/selected: load copy/part at f/text r/1 r/2 - r/1 + 1] 
        f: area 60x100 pairs
]]

Select pair from right and click "Select".