Live data from Hacker News

Sir, Please Step Away from the ASR-33 (2010)

queue.acm.org

281–290 of 291 posts

Re: Sir, Please Step Away from the ASR-33 (2010)

#281
post #167
post #157

Earlier quoted context omitted.

Colorforth not only does this but solved the colorblind problem by switching fonts.

I don't think colorforth "solved the colorblind problem" considering it has almost no adoption. Does anyone except Chuck Moore uses it? It has a fallback for colorblind people, which is better than nothing but is still terrible. The current way, plain text with everyone free to use syntax highlighters that change the color, font, or anything of the text is fine and works very well. I've heard about AST-based source o…

If something is terrible then comparatively you must have a better solution around.

Re: Sir, Please Step Away from the ASR-33 (2010)

#282

Earlier quoted context omitted.

This thread is making the point that the issue isn’t the character set, but rather the keyboards. We’re probably locked in, there is so much inertia around the standard QWERTY with a few arrows and Esc. Maybe an integrated system builder with large scale like Apple could shift things slightly.

CJK users are pretty successful at entering large numbers of Unicode characters with a QWERTY keyboard, and there's more of them than you.

Good point. Just lack of determination to make use of available techniques?

Re: Sir, Please Step Away from the ASR-33 (2010)

#283

Earlier quoted context omitted.

This thread is making the point that the issue isn’t the character set, but rather the keyboards. We’re probably locked in, there is so much inertia around the standard QWERTY with a few arrows and Esc. Maybe an integrated system builder with large scale like Apple could shift things slightly.

Indeed; Mac OS has supported easy entry of alternate (non-ASCII) characters on "self-inserting" keys with Option (which can be further modified with Shift) since the 80s. Granted it's a limited set, but they're useful. Here's a sampling “” … ™ Ω ç ß ∂ ∑ † π «» ¬ ˚ ∆ ƒ ∂

I normally use the Unicode keyboard so I can write out propositions, predicates, and set algebra. How many of us would readily adjust to the keyboarding required to break away from ASCII?

Re: Sir, Please Step Away from the ASR-33 (2010)

#284

Earlier quoted context omitted.

For me, the biggest problem with the whole maths ---> code mapping is that of nested brackets. For a random quick example, I mean things like (a*(1+exp(1i*theta[0,:]))+foo(x))/((b-cosh(bar(x))+(b+sinh(y[:,-1])). The sort of thing where it just _looks_ far nicer on a page with like _real fractions_ -- where missing a bracket or changing the order of two brackets can _totally_ bugger you. Yes, changing the form of the…

> a nice Euler angle transformation I'd probably go with something like: double cf = cos(phi),sf = sin(phi); double cp = cos(psi),sp = sin(psi); double ct = cos(theta),st = sin(theta); alpha = [ cp*cf-ct*sf*sp cp*sf+ct*cf*sp sp*st; -sp*cf-ct*sf*cp -sp*sf+ct*cf*cp cp*st; st*sf -st*cf ct]; but I agree it would look better with: alpha = [ cψ*cϕ-cθ*sϕ*sψ cψ*sϕ+cθ*cϕ*sψ sψ*sθ; -sψ*cϕ-cθ*sϕ*cψ -sψ*sϕ+cθ*cϕ*cψ cψ*sθ; sθ*sϕ…

In Raku you can also use × (U+D7) for multiplication

    # this assumes that ϕ, ψ, and θ have already been set

    my \cϕ = ϕ.cos; my \sϕ = ϕ.sin;
    my \cψ = ψ.cos; my \sψ = ψ.sin;
    my \cθ = θ.cos; my \sθ = θ.sin;

    my \alpha = [ cψ×cϕ−cθ×sϕ×sψ,   cψ×sϕ+cθ×cϕ×sψ,   sψ×sθ;
               −sψ×cϕ−cθ×sϕ×cψ,  −sψ×sϕ+cθ×cϕ×cψ,   cψ×sθ;
                sθ×sϕ,           −sθ×cϕ,            cθ];
I'm not sure if using × helps or hurts in this case since I'm not really experienced in this area.

These all work because Unicode defines ϕψθ as "Letter lowercase"

    say "ϕψθ".uniprops;
    # (Ll Ll Ll)
---

I would like to note that I used the Unicode "Minus Sign" "−" U+2212 so that it wouldn't complain about not being able to find a routine named "cϕ-cθ". (A space next to the "-" would have also sufficed.)

Re: Sir, Please Step Away from the ASR-33 (2010)

#285
post #99

Earlier quoted context omitted.

> ASCII is not a universal character set and treating it as such is nothing short of cultural imperialism: "If it's good enough for us, it's good enough for everyone". SI units like meters and kilograms are also cultural imperialism and we should return to diversity of units, ideally different one for each town. /s

Railway track gauges came to mind.

I remember reading an article that the width of railway track was set by the width of chariots.

I don't remember much about the article except it ended with some quip about the width of a car was determined by a couple of horses asses.

Re: Sir, Please Step Away from the ASR-33 (2010)

#286

Earlier quoted context omitted.

But "everyone" doesn't have the same keyboard nor does everyone speak the same language. ASCII is not a universal character set and treating it as such is nothing short of cultural imperialism: "If it's good enough for us, it's good enough for everyone". Artificial limits on language and characters sets might sound simple to you but it introduces a lot of complexity for others. Unicode code solves that problem with n…

Not sure why you're downvoted; it's simply true that ASCII is not universal. The "A" in ASCII stands for American. I am a monolingual English speaker but I think I should be able to write ÷, ≤ and ≥ in my Go code, and I think I should be able to do maths using π.

Raku

    say π ≤ 3+⅘ ≤ τ
    # True

    say π² ÷ 4
    # 2.4674011002723395

Re: Sir, Please Step Away from the ASR-33 (2010)

#287
post #265

Earlier quoted context omitted.

I'd love to use unicode on a current project - but just the unicode library is bigger than the memory of the small computer being used :( Seriously, unicode is appallingly messy and heavy-weight. With all that code-point space to burn, a rational design would be very different to what we've got.

All you need to know about unicode, is that they thought they could "unify" all the asian glyphs into one alphabet. That said, given the origins of writing, I dont think there are any much cleaner solutions. Their biggest mistake is probably not insisting on a mandatory vector representation which could be used to generate a "font-of-last-resort" My personal pet-peeve is that unicode have not yet assigned 128 code po…

They'd probably just define each of the segments separately and require you to use a zero width joiner.

Re: Sir, Please Step Away from the ASR-33 (2010)

#288

Earlier quoted context omitted.

> a nice Euler angle transformation I'd probably go with something like: double cf = cos(phi),sf = sin(phi); double cp = cos(psi),sp = sin(psi); double ct = cos(theta),st = sin(theta); alpha = [ cp*cf-ct*sf*sp cp*sf+ct*cf*sp sp*st; -sp*cf-ct*sf*cp -sp*sf+ct*cf*cp cp*st; st*sf -st*cf ct]; but I agree it would look better with: alpha = [ cψ*cϕ-cθ*sϕ*sψ cψ*sϕ+cθ*cϕ*sψ sψ*sθ; -sψ*cϕ-cθ*sϕ*cψ -sψ*sϕ+cθ*cϕ*cψ cψ*sθ; sθ*sϕ…

In Raku you can also use × (U+D7) for multiplication # this assumes that ϕ, ψ, and θ have already been set my \cϕ = ϕ.cos; my \sϕ = ϕ.sin; my \cψ = ψ.cos; my \sψ = ψ.sin; my \cθ = θ.cos; my \sθ = θ.sin; my \alpha = [ cψ×cϕ−cθ×sϕ×sψ, cψ×sϕ+cθ×cϕ×sψ, sψ×sθ; −sψ×cϕ−cθ×sϕ×cψ, −sψ×sϕ+cθ×cϕ×cψ, cψ×sθ; sθ×sϕ, −sθ×cϕ, cθ]; I'm not sure if using × helps or hurts in this case since I'm not really experienced in this area. Thes…

> × (U+D7) for multiplication

Blech; looks like a letter and normalizes cross products. Better to use "·" (U+B7)[0]:

  alpha = [ cψ·cϕ−cθ·sϕ·sψ,  cψ·sϕ+cθ·cϕ·sψ,  sψ·sθ;
           −sψ·cϕ−cθ·sϕ·cψ, −sψ·sϕ+cθ·cϕ·cψ,  cψ·sθ;
            sθ·sϕ,          −sθ·cϕ,           cθ];
Minus sign is a nice-to-have, though.

0: Also "∧" (U+2227, wedge), the real other vector product[1], but that doesn't matter for scalar multiplication.

1: http://en.wikipedia.org/wiki/Wedge_product

Re: Sir, Please Step Away from the ASR-33 (2010)

#289

Earlier quoted context omitted.

Formulae simply aren't understood like prose, or more precisely, formulae aren't understood as isolated bits of logic. For plumbing code where the logic is important, descriptive variable names are useful in aiding comprehension of the code. For formulaic code, where verifying the equality of two written expressions (one in code and one in the derivation, possibly on a piece of paper) compactness--so called simplific…

In the example, you are not really naming your variable usefully. You are merely transcribing from a one letter variable to its abstract name. You can do that in a general function, where the general concept is expressed, where it would still help me to understand your code and search for concepts and terms online, in case I do not understand what is going on. However, in many contexts it wont be merely an "einstein_…

Descriptive names will never help you understand the implementation of the business domain of math code. From the Domain-Driven design perspective, the symbols are the ubiquitous language which you should stick to.

Here is a more appropriate example, spot the bug in this Tolman-Oppenheimer-Volkoff equation:

    let radial_derivative_of_pressure = - (pressure + energy_density) * (4. * PI * pressure * radius_squared + mass_potential) / (radius_squared - 2. * mass_potential * radius)
vs (with the same bug)

    let dp_dr = - (p + rho) * (4. * PI * p * r2 + m) / (r2 - 2. * m * r);
Of course you have to look up the TOV equation to do so, even most domain experts would need to compare to a formula. One of these is much easier to compare and it isn't the spelled out version.

Your questions are unhelpful. It is merely the radial derivative of pressure. It is going to be used to be passed to a general purpose ODE integrator which just needs the radial derivative of pressure to integrate pressure for some range of radii. There is a real world equivalent: dp/dr; it is a known entity with exactly that symbol. Naming is not at all hard in this case: dp_dr or dpdr even dp_by_dr. Any other choice and you are just creating problems due to uncritical application of the belief that variable names should be descriptive while ignoring the fact that there is a well known ubiquitous language to describe these entities.

The closest thing in other business domains is common acronyms. Nobody is going to spell out GDPR in the implementation of their cookie banner. Nobody spells out HTTP, or JSON, or XML. Spelling them out won't help anyone trying to read the code, it just creates line noise.

Re: Sir, Please Step Away from the ASR-33 (2010)

#290

Earlier quoted context omitted.

In Raku you can also use × (U+D7) for multiplication # this assumes that ϕ, ψ, and θ have already been set my \cϕ = ϕ.cos; my \sϕ = ϕ.sin; my \cψ = ψ.cos; my \sψ = ψ.sin; my \cθ = θ.cos; my \sθ = θ.sin; my \alpha = [ cψ×cϕ−cθ×sϕ×sψ, cψ×sϕ+cθ×cϕ×sψ, sψ×sθ; −sψ×cϕ−cθ×sϕ×cψ, −sψ×sϕ+cθ×cϕ×cψ, cψ×sθ; sθ×sϕ, −sθ×cϕ, cθ]; I'm not sure if using × helps or hurts in this case since I'm not really experienced in this area. Thes…

> × (U+D7) for multiplication Blech; looks like a letter and normalizes cross products. Better to use "·" (U+B7)[0]: alpha = [ cψ·cϕ−cθ·sϕ·sψ, cψ·sϕ+cθ·cϕ·sψ, sψ·sθ; −sψ·cϕ−cθ·sϕ·cψ, −sψ·sϕ+cθ·cϕ·cψ, cψ·sθ; sθ·sϕ, −sθ·cϕ, cθ]; Minus sign is a nice-to-have, though. 0: Also "∧" (U+2227, wedge), the real other vector product[1], but that doesn't matter for scalar multiplication. 1: http://en.wikipedia.org/wiki/Wedge_pro…

It would be easy to just make `·` an alias. Then that code would work.

  my &infix: = &infix:;
(After all `×` itself is just an alias of `*` in the source for Rakudo.)

If you need more control you can write it out

  sub infix: (+@vals)
    is equiv(&[×])       # uses the same precedence level etc.
    is assoc   # may not be necessary given previous line
  {
    [×] @vals            # reduction using infix operator
  }
I made it chaining for the same reason `+` and `×` are chaining.

---

I don't know enough about the topic to know how to properly write `∧`.

It looks like it may be useful to write it using multis.

  # I don't know what precedence level it is supposed to be
  proto infix: (|) is tighter(&[×]) {*}

  multi infix: (
    Numeric $l,
    Numeric $r,
  ) {
    $l × $r
  }

  multi infix: (
    Vector $l, # need to define this somewhere, or use List/Array
    Vector $r,
  ) {
    …
  }
If it was as simple as just a normal cross product, that would have been easy.

  [[1,2,3],[4,5,6]] »×« [[10,20,30],[40,50,60]]
  # [[10,40,90],[160,250,360]]

  # generate a synthetic `»×«` operator, and give it an alias
  my &infix: = &infix:;

  [[1,2,3],[4,5,6]] ∧ [[10,20,30],[40,50,60]]
  # [[10,40,90],[160,250,360]]
Of course, I'm fairly confident that is wrong.
Post reply on HN