Discuss Scratch

Hardmath123
Scratcher
1000+ posts

Collab between me and Hardmath

Without even trying to understand what the above snippet does, I think it's really really ugly looking. Coffeescript does something better for prototype:
String::method = (a) -> a*a // or whatever
I'm not entirely convinced that's the best way to do lambda yet, because it isn't very obviously delimited. How about the following?
{arg, u, men, ts: arg*u + men*ts}
scimonster
Scratcher
1000+ posts

Collab between me and Hardmath

That doesn't look so bad. And it is also more obviously delimited.

Retired Community Moderator
BTW, i run Google Chrome 41.0.2272.101 on a Linux system - Ubuntu 14.04. NEW: iPad 4th gen. w/retina.

418 I'm a teapot (original - to be read by bored computer geeks)
THE GAME (you just lost)
; THE SEMICOLON LIVES ON IN OUR SIGS
scimonster
Scratcher
1000+ posts

Collab between me and Hardmath

So now, the object comparison prototype would look like:
define: Object __proto__ "<",
{less: ((typeof: this) = (typeof: less)) "&&":
this "all": {item, key: item "<": less key}
}

Retired Community Moderator
BTW, i run Google Chrome 41.0.2272.101 on a Linux system - Ubuntu 14.04. NEW: iPad 4th gen. w/retina.

418 I'm a teapot (original - to be read by bored computer geeks)
THE GAME (you just lost)
; THE SEMICOLON LIVES ON IN OUR SIGS
Hardmath123
Scratcher
1000+ posts

Collab between me and Hardmath

Wait, what? You want to compare key-value pairs individually? In what cases would that be useful?
String::"<" = {
this, other: return other.length < this.length;
}
scimonster
Scratcher
1000+ posts

Collab between me and Hardmath

That's not how JS does strings. But i decided i do like the String::“<” prototype syntax.
Oh, and what happened to your syntax there? You're using a dot to signify properties, a return statement, and an equals for assignment.

set: String::"<", {other:
if: ((this "toString":) = (other "toString":)), # this and other will be separate objects, but the same string, if they are the same
(this "substr": 2) "<": (other "substr": 2),
(this "charCode": 1) "<": (other "charCode": 1)
}

With arrays it's definitely useful. I don't see someone needing to do </> (wow that looks too much like an empty HTML closing tag ) on plain objects very often, but i think comparing by key is most intuitive.

Retired Community Moderator
BTW, i run Google Chrome 41.0.2272.101 on a Linux system - Ubuntu 14.04. NEW: iPad 4th gen. w/retina.

418 I'm a teapot (original - to be read by bored computer geeks)
THE GAME (you just lost)
; THE SEMICOLON LIVES ON IN OUR SIGS
Hardmath123
Scratcher
1000+ posts

Collab between me and Hardmath

I don't know what happened there, but it's obviously bad that I can't reliably use my own syntaxes.
scimonster
Scratcher
1000+ posts

Collab between me and Hardmath

Yeah. Remember, it's still fundamentally Scheme, but with a new syntax. We had agreed (i think) on not using = for setting. And the last statement in a lambda is returned.

Retired Community Moderator
BTW, i run Google Chrome 41.0.2272.101 on a Linux system - Ubuntu 14.04. NEW: iPad 4th gen. w/retina.

418 I'm a teapot (original - to be read by bored computer geeks)
THE GAME (you just lost)
; THE SEMICOLON LIVES ON IN OUR SIGS
scimonster
Scratcher
1000+ posts

Collab between me and Hardmath

Bump?

Retired Community Moderator
BTW, i run Google Chrome 41.0.2272.101 on a Linux system - Ubuntu 14.04. NEW: iPad 4th gen. w/retina.

418 I'm a teapot (original - to be read by bored computer geeks)
THE GAME (you just lost)
; THE SEMICOLON LIVES ON IN OUR SIGS
DigiTechs
Scratcher
500+ posts

Collab between me and Hardmath

Bump to you too!

I do, in fact, have my own site; it's here.
I'm also working on a thing called Fetch. Look at it here!
@thisandagain pls explain. @thisandagain pls explain. @thisandagain pls explain. @thisandagain pls explain. @thisandagain pls explain.
scimonster
Scratcher
1000+ posts

Collab between me and Hardmath

DigiTechs wrote:

Bump to you too!
I'm willing to let it go for a few days because hm is busy.

Retired Community Moderator
BTW, i run Google Chrome 41.0.2272.101 on a Linux system - Ubuntu 14.04. NEW: iPad 4th gen. w/retina.

418 I'm a teapot (original - to be read by bored computer geeks)
THE GAME (you just lost)
; THE SEMICOLON LIVES ON IN OUR SIGS
Hardmath123
Scratcher
1000+ posts

Collab between me and Hardmath

Ah, yeah, I have been insanely busy. I have written practically no working code in the past month.

I've been incubating this idea for a while now. I figure I should contribute something to this thread instead of constantly apologizing over not contributing anything, so here it is:

Asymptote's too scary and GeoGebra's too benign. Neither are truly built for the web. So imagine something like this:
A = (0, 0)
B = Mouse.position
L = Line(A, B)
M = Line((0, 1), (1, 0))
I = M.intersect(L)
This would draw two lines, one of which follows the mouse, and render the intersection. Points would be labeled the way you would draw them in a math proof. We'd take care of I/O issues, so that code would be all you need for that demo.

Also, the code is still Scheme at heart, if you think about it. The graphics are functional: there isn't any assignment, just definitions.

We could use either SVG or Canvas to render.

A slightly more involved example may be:
f(x) = x^2
render_curve(f)
P = (Mouse.x, f(Mouse.x))
Q = (Mouse.x+0.01, f(Mouse.x+0.01))
L = Line(P,Q)
This would render the parabola y=x^2 and then draw a tangent from the mouse position.

You would embed this into a site like this:
<script type="math/argon">
# insert math rendering here!
</script>


That syntax is kind of messy, and it could definitely use some cleaning up, but what are your initial thoughts? Ew, hmm, or whoa?
nXIII
Scratcher
1000+ posts

Collab between me and Hardmath

Hardmath123 wrote:

Also, the code is still Scheme at heart, if you think about it. The graphics are functional: there isn't any assignment, just definitions.
That sounds a lot like FRP. Cool!
A slightly more involved example may be:
f(x) = x^2
render_curve(f)
P = (Mouse.x, f(Mouse.x))
Q = (Mouse.x+0.01, f(Mouse.x+0.01))
L = Line(P,Q)
This would render the parabola y=x^2 and then draw a tangent from the mouse position.
render_curve doesn't seem very functional. Maybe you could declare Canvas with the Plot(thing1, thing2, …) function?
...
Canvas = Plot(f, L)
I hope you could also write that demo as:
...
L = PointSlope(P, D(f)(MouseX))
or maybe even:
...
L = PointSlope(P, f'(MouseX))

nXIII · GitHub
blob8108
Scratcher
1000+ posts

Collab between me and Hardmath

Hardmath123 wrote:

I have written practically no working code in the past month.
Aw, that sucks!

tosh · slowly becoming a grown-up adult and very confused about it
scimonster
Scratcher
1000+ posts

Collab between me and Hardmath

Eek, graphs. I'm not very good at graphing anything complex…

I'm like hmm.

Sorry for the long wait and short reply. I'm quite busy right now, but things should be back to normal in a few days.

Retired Community Moderator
BTW, i run Google Chrome 41.0.2272.101 on a Linux system - Ubuntu 14.04. NEW: iPad 4th gen. w/retina.

418 I'm a teapot (original - to be read by bored computer geeks)
THE GAME (you just lost)
; THE SEMICOLON LIVES ON IN OUR SIGS
Hardmath123
Scratcher
1000+ posts

Collab between me and Hardmath

scimonster wrote:

Eek, graphs. I'm not very good at graphing anything complex…
Uh-oh. But analytic geometry's so much fun!

(Sidenote: “graphing anything complex” probably refers to graphing complex numbers in the complex plane, which is a whole different beast. Do not be deceived.)
I'm like hmm.

Sorry for the long wait and short reply. I'm quite busy right now, but things should be back to normal in a few days.
Sure, no problem. I've got a 5-day holiday coming up.
blob8108
Scratcher
1000+ posts

Collab between me and Hardmath

Hardmath123 wrote:

Scimonster wrote:

I'm like hmm.

Sci clearly means:

> I'm, like, “Hmm…”.

tosh · slowly becoming a grown-up adult and very confused about it
scimonster
Scratcher
1000+ posts

Collab between me and Hardmath

Oops, forgot it was my turn to reply…

Hardmath123 wrote:

scimonster wrote:

Eek, graphs. I'm not very good at graphing anything complex…
Uh-oh. But analytic geometry's so much fun!
I'm sure. I just haven't learned much of it yet.

(Sidenote: “graphing anything complex” probably refers to graphing complex numbers in the complex plane, which is a whole different beast. Do not be deceived.)
I'm not up to functions, or really much of anything. My new mathbook hasn't come yet, and the old one didn't have too much more than `x = y+5` and `y = x^2`.

Question: What happened to the JavaScript-with-improved-syntax goal?
And do you realize we've been discussing this for over a year and have nothing?

Retired Community Moderator
BTW, i run Google Chrome 41.0.2272.101 on a Linux system - Ubuntu 14.04. NEW: iPad 4th gen. w/retina.

418 I'm a teapot (original - to be read by bored computer geeks)
THE GAME (you just lost)
; THE SEMICOLON LIVES ON IN OUR SIGS

Powered by DjangoBB

Standard | Mobile