Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Toomas Vooglaid
    @toomasv
    Took a quick sailing trip on weekend:
    sailing
    GiuseppeChillemi
    @GiuseppeChillemi
    Beware, season is ending and sea condition could change quickly !
    Toomas Vooglaid
    @toomasv
    Yes, taking advantage of the good weather and last days before September.
    Gregg Irwin
    @greggirwin
    The Raycasting Regatta?
    Toomas Vooglaid
    @toomasv
    Minimal raycasting still, but potential for multiple strategy games. E.g. manipulating results with wind-shifts:
    sailing2
    Gregg Irwin
    @greggirwin
    Nice. Your examples may prove very useful as we evaluate options for smooth animation.
    Toomas Vooglaid
    @toomasv
    Currently the integer coordinates set certain limits and make movements and directions somewhat jumpy.
    Toomas Vooglaid
    @toomasv
    Hooray! Resuscitated my old zooming func:
    zooming
    Semseddin Moldibi
    @endo64
    That's brilliant @toomasv ! We should have a dedicated red/toomas room!
    Toomas Vooglaid
    @toomasv
    :joy:
    GiuseppeChillemi
    @GiuseppeChillemi
    @toomasv No joke, I agree with @endo64 !!!
    Gregg Irwin
    @greggirwin
    Sandbox is perfect, because @toomasv plays in it. :^)
    And yes, the zooming is really nice, being mouse pos sensitive.
    Comments in the code will help those of us who don't live in draw to suss things out. I expected a lot more code. What's there is just...magic.
    Toomas Vooglaid
    @toomasv
    Comments added.
    Here is application with different faces:
    zoom-and-move
    GiuseppeChillemi
    @GiuseppeChillemi
    😮
    Dave Andersen
    @dander
    @toomasv those demos look great! I noticed though that the coordinates used for zooming depend on the position of the window on the screen. So if you drag the box down and to the right and try to zoom, the objects jump around a bit.
    Toomas Vooglaid
    @toomasv
    @dander Thanks for reporting! On which platform? On W10 it doesn't do this. At least on Aug 9 build. It used to behave thus earlier and I had to find positions in relation to screen, but now it seems to be corrected on W. May be not on other platforms?
    Dave Andersen
    @dander
    I'm on win 10 too, but it seems like a bit of an older build. I'll try updating and see if that makes a difference
    Dave Andersen
    @dander
    @toomasv that fixed it :smile:
    Toomas Vooglaid
    @toomasv
    :relieved:
    Dave Andersen
    @dander
    it seems really neat and useful :thumbsup:
    Gregg Irwin
    @greggirwin
    @toomasv thanks! Nice updates. Once we get @rebolek's stylize in place, I can see people leveraging this a lot. Could be used for GUI designers as well as drawing and diagramming tools.
    Boleslav Březovský
    @rebolek
    @greggirwin I hope to finish it this month, I know where the problem is, but doing it right is, unfortunately, time-consuming as I have to recompile whole Red on every change. So it’s just a matter of time.
    Boleslav Březovský
    @rebolek
    Have you ever wondered if the current value is of type x! what's the probability that the next value will be of typey!? Probably not, I know. But I've got the stats anyway (for some random script that I used for testing):
    #(
        word!: #(
            block!: 20.92675635277%
            file!: 0.1494768310912%
            word!: 54.85799701046%
            set-word!: 7.772795216741%
            refinement!: 3.139013452915%
            paren!: 5.231689088191%
            lit-word!: 0.5979073243647%
            char!: 1.046337817638%
            integer!: 1.644245142003%
            string!: 2.092675635277%
            get-word!: 0.1494768310912%
            path!: 2.391629297459%
        )
        block!: #(
            word!: 46.15384615385%
            set-word!: 53.84615384615%
        )
        file!: #(
            set-word!: 100%
        )
        set-word!: #(
            word!: 64.70588235294%
            map!: 1.960784313725%
            block!: 14.70588235294%
            path!: 7.843137254902%
            integer!: 4.901960784314%
            string!: 4.901960784314%
            char!: 0.9803921568627%
        )
        string!: #(
            word!: 66.66666666667%
            set-word!: 19.04761904762%
            char!: 4.761904761905%
            paren!: 4.761904761905%
            block!: 4.761904761905%
        )
        refinement!: #(
            refinement!: 14.81481481481%
            word!: 85.18518518519%
        )
        map!: #(
            word!: 50%
            set-word!: 50%
        )
        paren!: #(
            word!: 76.08695652174%
            paren!: 4.347826086957%
            string!: 10.86956521739%
            path!: 2.173913043478%
            set-word!: 2.173913043478%
            get-word!: 4.347826086957%
        )
        lit-word!: #(
            word!: 58.33333333333%
            lit-word!: 33.33333333333%
            string!: 8.333333333333%
        )
        path!: #(
            block!: 27.27272727273%
            word!: 54.54545454545%
            set-word!: 6.060606060606%
            set-path!: 3.030303030303%
            path!: 6.060606060606%
            string!: 3.030303030303%
        )
        char!: #(
            path!: 7.142857142857%
            word!: 57.14285714286%
            string!: 7.142857142857%
            set-word!: 21.42857142857%
            paren!: 7.142857142857%
        )
        integer!: #(
            word!: 52.94117647059%
            integer!: 5.882352941176%
            set-word!: 23.52941176471%
            path!: 5.882352941176%
            block!: 5.882352941176%
            set-path!: 5.882352941176%
        )
        get-word!: #(
            word!: 100%
        )
        set-path!: #(
            word!: 100%
        )
    )
    Semseddin Moldibi
    @endo64
    @rebolek That's interesting. We can feed your code with more scripts and put the results somewhere, later we might update VS Code extension to use that and open a bracket after a word automatically.
    Boleslav Březovský
    @rebolek
    @endo64 thanks, I of course plan to feed it with more scripts and also to not check just by types but by value also.
    Gregg Irwin
    @greggirwin
    Very interesting indeed @rebolek. I did old stats on what funcs were used most commonly, and always liked that we could analyze Redbol code and data for this kind of insight. The 100% items jump out at me.
    I think you did something similar for the frequency of type usage, yes @rebolek?
    Boleslav Březovský
    @rebolek
    @greggirwin yes, I'm diving deeper and deeper into code statistics :)
    Gregg Irwin
    @greggirwin
    What will be really cool, is to tie this into ticket processing, so we can start to identify patterns that lead to bugs.
    Boleslav Březovský
    @rebolek
    @greggirwin I'm working on fuzzy tester, that's why I need these stats.
    Boleslav Březovský
    @rebolek
    And with fuzzy tester, identifying patterns that lead to bugs should be easier and automated.
    Boleslav Březovský
    @rebolek
    I've already got a few improvements in mind, now that it's working. Looking not for just types, but for specific values and checking not just one, but more values in advance. So with a few simple improvements, it should be able to identify things like func block! block!without looking at func definition.
    Semseddin Moldibi
    @endo64
    @rebolek In the end we can use it many places like static code analysis, like PHPStan https://medium.com/@ondrejmirtes/phpstan-2939cd0ad0e3 or RIPS https://www.ripstech.com/
    Boleslav Březovský
    @rebolek
    @endo64 Thanks for links, I take a look at it.
    Boleslav Březovský
    @rebolek
    Another useless statistic: there are 40984 blocks in Red source code, the average length is 8, 1923 blocks are empty and the longest block has 80662 values.
    Boleslav Březovský
    @rebolek
    Another one, this time TOP20 of words in Red source!
        --assert: 42872 
        --test--: 25730 
        =: 18293 
        strict-equal?: 12517 
        i: 6983 
        j: 6476 
        a: 4688 
        parse: 3996 
        not: 3449 
        make: 3431 
        b: 2588 
        none: 2519 
        to: 2367 
        equal?: 2268 
        ===start-group===: 2171 
        ===end-group===: 2157 
        -: 1995 
        skip: 1768 
        try: 1758 
        +: 1705
    Non-symmetric ===start-group=== and ===end-group=== looks suspicious...
    Boleslav Březovský
    @rebolek
    So there are really some ===end-group=== marks missing in tests. For example https://github.com/red/red/blob/master/tests/source/units/find-test.red#L368 Looks like the statistics aren't that useless as I thought :smile:
    Semseddin Moldibi
    @endo64
    Nice statistics!
    Gregg Irwin
    @greggirwin
    Good stuff @rebolek ! Being able to treat code as data this way is so great. We can learn from this. And we can do it like no other language, because the rich set of datatypes will provide even more patterns and information.
    e.g., we can look at function specs, and correlate usage and issues. Given a func with a series! arg, how often is it called with each type or pseudotype of series? If it dispatches on type with switch/case, are all possible types covered? Do refinements get used? Do they lead to bugs? Are well-doc'd funcs less prone to errors in usage, or to internal bugs? Are there patterns associated with reliability based on bodies? It's a world of ways to look at things.
    Semseddin Moldibi
    @endo64
    I used this function once, it loads all values including the unloadable ones (by converting them to strings), could be useful for someone:
    load-safe: function ["Loads all values, convert unloadable values to string" value] [
        ws: charset " ^-^/^M^(00A0)"
        r: load/trap value
        while [error? r/3] [
            ;Stringfy the unloadable value
            either pos: find insert r/2 {"} ws [insert pos {"}] [append r/2 {"}]
            r: load/trap/into r/2 r/1
        ]
        r/1
    ]
    
    >> load "a 1k b 2xx4"
    *** Syntax Error: invalid integer! at "1k b 2xx4"
    
    >> load-safe "a 1k b 2xx4"
    == [a "1k" b "2xx4"]
    Well, actually it is not safe as its name says :)
    Gregg Irwin
    @greggirwin
    :^)
    An interesting twist would be to provide a callback for unloadable values.
    Semseddin Moldibi
    @endo64
    Yes, could be useful.

    I just realized load/trap points to the string position where the issue happen for invalid value/syntax:

    load/trap {3"a}
    == [[3] {"a} make error! [  <-- points to "
        code: 200
        type: 'syntax
        id: 'invalid

    But, points to the string just after the issue, for missing:

    load/trap {] 3}
    == [[] " 3" make error! [  <-- point to space char after ]
        code: 201
        type: 'syntax
        id: 'missing
    Gregg Irwin
    @greggirwin
    Good to note. Maybe in Guru Meditations?