Snavanced!

Yes, obviously without the BigNumber library and I do it all myself, only creating a ComplexNumber class based on the Number, ComplexNumber isn't a string, the BigNumber library has strings for the complex numbers, obviuosly. :dotted_line_face:

This isn't obvious to me; the printform is a string but I expect that internally the library uses two floats, one for the real part and one for the imaginary part.

Why didn't you want to use the library? Or some library? It seems like a funny thing to reinvent, especially since it's hard to get right. Do you, for example, handle trig functions of complex numbers?

Only I'm learning that with a teacher of Chimbote because I just want more ideas for my br(ia)n. :grin:
Copia de untitled script pic
Obviously you can't import that script picture to Snap! because has no metadata about it and my mod includes new blocks that a normal Snap! user can't export them into Snap! but in Super-Snap!, yes. :slight_smile:
I can't handle trigonometric functions for the complex numbers yet, but I do things faster than the other developers of the main Snap! did. (includes you my dear Brian) :tuit:

We didn't exactly do complex arithmetic; we just included a library someone else wrote that gives us the complete Scheme numeric tower (bignum, exact rational, float, and complex).

Yes, I saw the library, and is external, created in 2009 I see, that library just did an idea for my :tuit:.
I replaced all of the lambdas with these old blocks that you can see :grin:...
untitled script pic (1)
This block for example, checks if the list exclusively contains the selected item, if there are items that are no equal to that item, just check as false, if the list is empty, check as false too :astonished:...
untitled script pic (2)
This is a video about hidden inputs, there are just modified variadic inputs, they just hide the first of their children and only have one children. :shushing_face:
ezgif.com-video-to-gif
Don't be sad, I did this for you, is the primitive that you wanted. :pleading_face:
Untitled script pic
Soon I have to release the code of Super-Snap! take as important the functions that you want, I just did all of my time this mod to accomplish the user's needs, don't forget it, I'm free to do it for you. :face_holding_back_tears:

I'm still very excited for this release.

Thank you for your opinion, dear. :nerd_face:

Please make it so we can import Snap! 7 scripts

Ok, I'm going to do that, sup. :saluting_face:

Thank you! Thank you so much.

It took me a while to figure out what that movie was about because I was looking at the blocks and the text, and the arrowheads totally escaped my notice. :~)

This may be too hard to implement, but what would make that feature perfect would be if hovering over the (right-facing) arrowhead showed the parameter's name as hovertext, for the situation in which there are three of them in a row and the user doesn't remember what order they come in.

Although, on the other hand, what I really want is that the long form input dialog should say

○ Multiple inputs (value is list of inputs)    min ( ) default ( ) max ( )

where the ( ) are numeric input slots. So the hidden input case is 0/0/1. If MAX is omitted it means ∞, so the usual case is 0/1/⎵.


I think you picked the wrong base case for ONLY HAS. If the list is empty it should report True. This is the common situation with for-all functions, which are sort of defined negatively; ONLY HAS means "there aren't any items that aren't 5." And if there aren't any items at all, then there aren't that aren't 5. Formally,

[∀x∊S | x=v] ⟷ [~∃x∊S | x≠v]

where S is the set of values in the list and v is the value you're testing against.

AND has True as its base case for the same reason; it says ∀x∊S x.

Thank you too, Brian! :innocent:

Yes, but I think only about the division operator first, thank you for let me check your ideas to me. :slight_smile:

That's not the case, I mean that ONLY HAS means if in the list contains 5, but if there are any items that are not 5 in the list, just check it as false because these extra items changes any function that uses lists to set positions of sprites or any another morph, that's why the function means, but yes, you have the reason too, master. I think to leave the function as normal without changing nothing. :slight_smile:

I'm not sure what you mean by this.

Imho, primitives shouldn't be designed around one particular application that you have in mind. They should be as general as possible. The user program for your application will be more self-documenting if it says

(ONLY HAS ...) AND (NOT (IS ... EMPTY?))

And yes, if you do it your way I can build the function I want with

(ONLY HAS ...) OR (IS ... EMPTY?)

but, how do I put this, non-emptiness is a significant part of the definition of the kind of list you're looking for, whereas the other way it's "oh yeah, or it can be empty" which isn't what I want to think about.

But, whatever, it's your language! :~)

@alessandrito123 link?


Well, complex numbers trigonometry is now available to Super-Snap!, there are more mathematical constants, the integral block (not at all but works as my CASIO), adding the backpack and made the flag, the gear symbol and the globes symbols to be more beauty, (the flag looks like Scratch 2.0). :~)


This is my cooler CASIO calculator, I do a photo of that lil' thing in my house. The calc is sleeping. :~)


If you are interested in getting the cute symbols, just copy the code like an userscript. :~)

SymbolMorph.prototype.renderSymbolFlag = function (ctx, color) {
    // draw a flag
    var w = this.symbolWidth(),
        h = this.size,
        l = Math.max(w / 12, 1);

    ctx.lineWidth = l;
    ctx.strokeStyle = color.toString();
    ctx.beginPath();
    ctx.moveTo(l * 2, 0);
    ctx.lineTo(0, h);
    ctx.stroke();

    ctx.lineWidth = h / 2;
    ctx.beginPath();
    ctx.moveTo(w / 8, h / 4);
    ctx.bezierCurveTo(
        w / 1.25,
        h / 2,
        w / 2,
        h / 2,
        w,
        h / 2
    );
    ctx.stroke();
};

SymbolMorph.prototype.renderSymbolGears = function (ctx, color) {
    // draw gears
    var w = this.symbolWidth(),
        r = w / 2,
        e = w / 8;

    ctx.strokeStyle = color.toString();
    ctx.lineWidth = this.symbolWidth() / 4;

    ctx.beginPath();
    ctx.arc(r, r, w, 0, radians(360), true);
    ctx.arc(r, r, e * 2, 0, radians(360), false);
    ctx.closePath();
    ctx.clip();

    ctx.moveTo(0, r);
    ctx.lineTo(w, r);
    ctx.stroke();

    ctx.moveTo(r, 0);
    ctx.lineTo(r, w);
    ctx.stroke();

    ctx.moveTo(e, e);
    ctx.lineTo(w - e, w - e);
    ctx.stroke();

    ctx.moveTo(w - e, e);
    ctx.lineTo(e, w - e);
    ctx.stroke();
};

SymbolMorph.prototype.renderSymbolGlobeBig = function (ctx, color) {
    this.renderSymbolGlobe(ctx, color, true);
};

SymbolMorph.prototype.renderSymbolGlobe = function (ctx, color, detailed) {
    // draw a stylized globe
    var w = this.symbolWidth(),
        l = Math.max(w / 30, 0.5);

    ctx.strokeStyle = color.toString();
    ctx.lineWidth = l * 2;

    ctx.beginPath();
    ctx.arc(w / 2, w / 2, w / 2 - l, 0, radians(360), false);
    ctx.stroke();

    if (detailed) {
        ctx.moveTo(l * 4, w / 5);
        ctx.lineTo(w - l * 4, w / 5);
        ctx.stroke();
        ctx.moveTo(w / 2, 0);
        ctx.lineTo(w / 2, w);
        ctx.stroke();
        ctx.moveTo(l * 4, w * 4 / 5);
        ctx.lineTo(w - l * 4, w * 4 / 5);
        ctx.stroke();
    };
    
    // single line version, looks better when small:
    ctx.beginPath();
    ctx.moveTo(w / 2, l / 2);
    ctx.arcTo(0, w / 2, w / 2, w, w * 2 / 3);
    ctx.stroke();

    ctx.beginPath();
    ctx.moveTo(0, w / 2);
    ctx.lineTo(w, w / 2);
    ctx.stroke();

    ctx.beginPath();
    ctx.moveTo(w / 2, l / 2);
    ctx.arcTo(w, w / 2, w / 2, w, w * 2 / 3);
    ctx.stroke();
};

SymbolMorph.prototype.renderSymbolTick = function (ctx, color) {
    // draw a check mark
    var w = this.symbolWidth() / 3;

    ctx.strokeStyle = color.toString();
    ctx.lineWidth = Math.max(w / 20, 0.5) * 2;
    ctx.lineCap = 'round';
    ctx.lineJoin = 'miter';
    ctx.beginPath();
    ctx.moveTo(0.5 * w, 1.5 * w);
    ctx.lineTo(1.5 * w, 2.5 * w);
    ctx.lineTo(2.5 * w, 0.5 * w);
    ctx.stroke();
};

For now, the integral's code is here to be in good hands. :~)

SpriteMorph.prototype.blocks.reportIntegral = {
            type: 'reporter',
            category: 'operators',
            spec: '⌠ %n %br ⎮ \[ %n \( x ^  %n \) \] dx %br ⌡ %n'
};

Process.prototype.reportIntegral = function anonymous (a, b, c, d) {a = +a; b = +b; c = +c; d = +d; return Process.prototype.reportBasicQuotient(Process.prototype.reportBasicProduct(b, Process.prototype.reportBasicDifference(Process.prototype.reportBasicPower(a, Process.prototype.reportBasicSum(c, 1)), Process.prototype.reportBasicPower(
d, Process.prototype.reportBasicSum(c, 1)))), Process.prototype.reportBasicSum(c, 1));};

But if you want the integral as a custom block, just think to see its definition, here:
untitled script pico
Or copy it as XML too:

<blocks app="Snap! 9.0, https://snap.berkeley.edu" version="2"><block-definition s="⌠ %&apos;a&apos; $nl ⎮ [ %&apos;b&apos; ( x ^ %&apos;c&apos; ) ] dx $nl ⌡ %&apos;d&apos;" type="reporter" category="operators"><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%n"></input><input type="%n"></input><input type="%n"></input></inputs><script><block s="doReport"><block s="reportQuotient"><block s="reportVariadicProduct"><list><block var="b"/><block s="reportDifference"><block s="reportPower"><block var="a"/><block s="reportVariadicSum"><list><block var="c"/><l>1</l></list></block></block><block s="reportPower"><block var="d"/><block s="reportVariadicSum"><list><block var="c"/><l>1</l></list></block></block></block></list></block><block s="reportVariadicSum"><list><block var="c"/><l>1</l></list></block></block></block></script></block-definition></blocks>

Oh gosh I've gone a long time not responding to this.

How much calculus do you know? I see your integral block just handles powers of x. You can do numerical integration (finding the value of the integral at a particular value of x) of any function by going back to the definition of the integral, which is something like

$$$\int_a^b f(x) dx = \lim_{\Delta x\rarr0}\sum_{i=0}^{\lfloor(b-a)/\Delta x\rfloor}f(a+i\Delta x)\cdot\Delta x$$$

So you can get a pretty good approximation by setting $$\Delta x$$ to some tiny number, like say 1.0e-30, and computing the sum with that value. If you want to be sure of doing a super good job you then try 1.0e-40 and so on, stopping when two consecutive values are equal. There are weird functions for which it may not work, e.g., if you try to compute the integral of the tangent function over a range that includes 90°, so the value of the function at that point is infinite.

(Note, if you really use my $$\Delta x$$ values it'll take a very very long time to compute the sums. Probably 0.00001 will be small enough for most purposes.)

Yes Brian, you are in reason. I'm just learning that because I'm too curious, but yes, I calculated the very good approximation of the integral without loops or iterations because I see the patterns of the basic integral on my calculator, I'm not to calculate more integrals for now because they need more patterns to solve and yes, too complicated. You are an amazing teacher Brian, just see the extra features of the mod, I'm just doing it for you and for the other Snappers, some code is revealed because I want to share you my proposals, thanks for responding to me, but I have to sleep now, see ya in the school! :slight_smile:

Yeah me too!

when will it be released?

How did you add all the blocks?

is this out yet?