News for hackers. Stuff that matters.

binrec

Re:The Weeds Are Winning on Friday November 08, 2024 @04:22PM (#42090576)
> Populations of the weeds have been found that are impervious to nine different classes of herbicides. The plant can grow more than two inches a day to reach eight feet in height and dominate entire fields. Originally from the desert Southwest, it boasts a sturdy root system and can withstand droughts.

Well, I'm sold. Where do I buy Palmer amaranth? What about water hemp - is it edible?

Re:A smart redesign of chess pieces on Thursday January 25, 2024 @03:39PM (#39134951)
cf. Bernard Parham's "Matrix Notation", which uses the same shapes for pawns, bishops, rooks, and (almost) queens: https://www.thechessdrum.net/talkingdrum/TheMatrix/index.htm...
Re:Food coloring, anti-caking nanoparticles may affect human gut on Wednesday February 15, 2023 @04:49PM (#34811096)
Titanium dioxide is used as a colorant to make things look whiter. It's common in cottage cheese, for example.
Re:Firefox Loses Users and Websites on Monday August 08, 2022 @06:19PM (#32391824)
V8 has such a lax approach to memory management that I sometimes wish I could drop support for everything but Firefox. For example, Promise.race() leaks memory in V8: https://github.com/nodejs/node/issues/17469#issuecomment-685...

Another issue I ran into recently is that `Symbol.for(str)` will cause the entirety of `str` to be allocated forever in Chromium, but not in Firefox. (It's inevitable that `Symbol.for()` will have some memory impact, as a global allocation, but it's possible to mitigate it somewhat.)

IMO it's too bad that the effort to create a Node-alike driven by Spidermonkey instead of V8 never got anywhere.

> To tap into the core layers of language, Starostin’s team starts with an established list of core, universal concepts from the human experience. It includes meanings like “rock,” “fire,” “cloud,” "two,” “hand,” and “human,” amongst 110 total concepts.

In English, "rock" and "human" are loans and "cloud" is an innovative form.

> For Proto-Japonic, we introduce two distinctly different versions of the wordlist, since there are some significant unresolved problems in its reconstruction where adhering to one or the other solution influences the results of testing – namely, the reconstruction of Proto-Japonic by Sergei Starostin (1991), later adopted for the Altaic etymological dictionary (Starostin et al., 2003), posits an initial *d- for Proto-Japonic, whereas a more conservative approach prefers the phonetic interpretation of the same phoneme as *y- (Martin, 1987, gives no preference to either approach; both Vovin, 2005, and Robbeets, 2005, explicitly reject *d-; see Supplementary Material for details). Ultimately, we have to perform two sets of calculations because of these differences in interpretation of Proto-Japonic phonology.

There's no legitimate reason to follow Starostin here - that reconstruction is based on back-projection of an obviously secondary fortition specific to Yonaguni.

IMO "macrofamily" isn't a well-defined enough concept not to be disputed by definition. Sino-Tibetan and Afroasiatic are very large and very old, but not as controversial as Altaic; Austro-Tai and Dene-Yeniseian are classic "macrofamilies" in that they're positing old relations between different established language families, but they're increasingly accepted, at least as promising lines of research.

Lexical comparison isn't the standard for demonstrating language relatedness, though. Regular sound correspondences, morphological evidence, and commonalities in irregularities (e.g. English I/me ~ French je/moi or English good/better ~ German gut/besser) are ideal. Quantitative methods range from extremely preliminary to nonsense.

This might be unfair of me, but IMO research from the Greenberg school (the Starostins, Bengtson, Ruhlen, etc.) or the automatic phylogeny school (List, the ASJP, etc.) can pretty much be ignored.

Re:WinCompose – A Compose Key for Windows on Friday August 13, 2021 @12:16PM (#28170850)
It's not an off-the-shelf solution, but what I do is roll my own keyboard layout with MSKLC.
Re:Farming robot kills 100k weeds per hour with lasers on Monday April 26, 2021 @01:01PM (#26944925)
> I thought all plants (by definition?) need photosynthesis to stay alive in non-dormant states.

There are parasitic plants that don't photosynthesize at all, like the Monotropoideae and Rafflesiaceae.

Among photosynthesizing plants, rhubarb can be "forced" (grown in complete darkness to reduce bitterness and get an earlier harvest), and potatoes can sprout if left in the pantry for too long.

Re:Amazon Fresh Opens in London on Monday March 08, 2021 @05:57PM (#26392795)
If pickles are called gherkins, what are gherkins called? Or is there no separate word for them?

(In the US, a gherkin is a small pickled cucumber. A cornichon is a type of gherkin, but there are other types.)

Re:Things Unexpectedly Named After People on Sunday July 19, 2020 @01:29PM (#23890855)
Suitland and Beltsville, MD - suburbs of DC named after local landowners, Samuel T. Suit and Truman Belt.
Musk is a great hype man in an industry where hype is the difference between success and failure. If he'd started out in a different field, he could've been the next Tom Ford or Zaha Hadid. That's not necessarily a statement about the quality of his or his companies' work - Zaha Hadid does not make nice buildings, and I wouldn't buy a Tesla - but it's difficult to say whether Tesla would've succeeded if not for Musk's hype... and the point of great hype men is that people buy into the hype.

On balance, having a hype man for [PayPal Mafia voice] innovation in the world of atoms seems like a good thing. Musk may not be the best person for the role, but you probably have to be a little crazy to want to be a celebrity in the first place.

> I guess you could totally do it from mobile. But then you have to fight the app store's distribution/marketing model.

I don't know much about the mobile world, so this may be a stupid question, but could you route around the app store problem by making a progressive web app?

I assume a backend of some sort would be necessary, since JS in the browser is a pretty limited environment, but if Chalkinator Desktop is handling your server setup anyway, it could install a personal backend on it for you, and the PWA could talk to that.

Decomposition of glyph sequences in phonetic transcription alphabets (e.g. IPA representations of phonemes) into phonological feature sets.

Existing attempts to solve this problem are hackish and difficult to customize: they typically treat each glyph as a set of features and handle diacritics and digraphs by naive composition and awkward special-casing. They also aren't written with an eye to customization in either alphabet or featural model: they typically map an ad-hoc extension of IPA to an ad-hoc featural model.

I think a natural improvement would be to develop a specification language in which each individual glyph (base character or diacritic) is a function from a feature set to a feature set, with Haskell-style pattern-matching to allow graceful handling of digraphs and context-sensitive diacritics - although syntactic sugar for digraphs would in practice be required for usability. Ideally it would also be possible to map feature sets to feature sets, in order to preserve a human-readable intermediate form (e.g. "unvoiced dental plosive") which is later mapped to the more customary binary features.

In addition to the utility for phonological databases and the like, this would also enable more rigorous testing of crosslinguistic feature sets: every feature set is implicitly a set of proposed linguistic universals and existence claims. If two segments have the same featuralization, they should never contrast in a given language; if they do, the featuralization is unsound. And if a featuralization proposes the existence of many contrasts that aren't attested anywhere, it could probably stand to be optimized.

But most of my interest in this comes from my work on a phonological database. The database needs some method of handling featuralization to facilitate feature-based search, and I just haven't seen a good way to do that yet.

Re:What does Unicode support actually mean? on Monday June 15, 2020 @11:00AM (#23527987)
Chrome's Ctrl+F behavior is damned annoying for handling linguistic data. When I search for ʰ (aspiration), I don't want h (the letter, which appears in some of the column headers and most of the notes entries) - conflating the two makes searching for ʰ practically worthless. If I couldn't turn off "ASCII characters match everything that looks vaguely like them" in Google Sheets (i.e. enable regex search), I wouldn't use Google Sheets.

...and now that I've complained about it I notice that there are extensions to enable regex search in the browser itself, nice

Re:Is Dark Mode Such a Good Idea? on Friday June 12, 2020 @06:03PM (#23504363)
Easier to read for whom?

I have pretty bad eye floaters, and they're more visible in bright light. Having crud bouncing around my entire field of vision does not make for an easy or strain-free reading experience, so I enable dark mode whenever it's an option. I found checking Zulip at work pretty unpleasant until I realized I could enable dark mode.

If you're running a scientific study and basing your conclusions on the average of all participants, you might not pick up on things like that. And if you're running a scientific study on people with normal vision, a sufficiently strict definition of "normal vision" guarantees that you won't pick up on that, although the studies in question probably didn't use so strict a definition.

Even if dark mode is "scientifically worse" for most people, whatever that means, it's a useful accommodation. In fact, the Nielsen Norman Group article that this post links to argue against dark mode recommends dark mode as an accommodation for people with vision impairments.

Re:Ask HN: What is the cheapest way to make a website? on Tuesday June 02, 2020 @06:55PM (#23397492)
https://neocities.org/ has a free tier. It's limited (no arbitrary filetype uploads, no custom domains), but convenient and easy to use.
Re:Swadesh List on Thursday August 15, 2019 @05:32AM (#20703792)
A few weeks ago I got curious about the phonological development of Rotokas and figured I'd see if any reconstruction could be done on the North Bougainville languages. The only documentation I could find for Ramopa and Askopan at all were Rosetta Project Swadesh lists on archive.org - talk about coverage!
Re:Ask HN: Who is hiring? (May 2019) on Thursday May 02, 2019 @05:34PM (#19813199)
The DC area is pretty suburbanized. It's not uncommon for people who work in DC to have hour-long commutes - when I lived there, I met people who commuted to DC from as far out as Frederick and Mt Airy - but the MARC is (in my experience) reliable and some of the suburbs aren't bad. Zillow has $300k-$400k houses in Germantown.
Re:Lexical Distance Among Languages of Europe (2015) on Wednesday April 17, 2019 @10:23PM (#19688240)
Interesting map.

The methodology probably wouldn't be comparable to Tyshchenko's, but there is an estimate for the lexical distance between Tocharian and the other Indo-European language families (10.2307/601651) - Tocharian comes out closest to Germanic and Greek.

Then again, Tocharian wasn't spoken anywhere near Europe when it was attested, so it isn't strictly within the scope of the map - but it's unclear how it got there. The most popular view, as far as I know, is that it was the second family to branch off of Indo-European, after Anatolian, but Adams showed that it shares some innovations with Germanic (the reflexes of syllabic resonants and the expansion of the singulative function of the n-stems to adjectives) and Greek (a locative dual *-oisi, represented in the Tocharian B genitive dual), and Eric Hamp placed Tocharian in a 'Northern Indo-European' subgroup with Germanic, Balto-Slavic, and Albanian.

Re:Why Concatenative Programming Matters (2012) on Wednesday April 17, 2019 @01:34PM (#19684615)
>Functional programming IS immutable programming the two are one and the same.

Yes, and many imperative languages allow you to use, in an idiomatic manner, a functional style that avoids mutable state, even though these languages aren't designed around the functional paradigm, and don't require you to adhere purely, in the colloquial sense that means "strictly" or "completely" but has fewer letters, to it. And the reason for this is that people have taken ideas from languages that were designed to be functional rather than imperative.

If you want to bring up map and reduce, what's their genealogy? Did the imperative world get the idea from ALGOL? Maybe they did, but I'd be surprised.

>See? Concatenative programming in javascript. And it's not less convenient.

It still isn't great. To avoid stepping outside the paradigm, you have to be willing to curry every function that needs multiple parameters. And I don't know what that recursion is doing there - presumably I don't know what I'm talking about again, but it seems to me that the entire body of `xToYPower` could be replaced with `return y => x y`.

Re:Why Concatenative Programming Matters (2012) on Wednesday April 17, 2019 @05:22AM (#19681006)
>You are using a stack which is not immutable.

Yes, but that's beside the point. I said "style", not "paradigm". The basic structure, not the totality of the thing. I don't know what CS researchers would think of this distinction, but it seems convenient to have in practice.

You can use a functional style in Javascript without insisting on pure immutability throughout your entire project, and there are advantages to being able to do so. There are also advantages to being able to use a concatenative style, which is why the pipeline operator was proposed.

It would be possible to rewrite that code to use an immutable stack, but for the purpose of illustration - specifically, illustrating that there isn't currently a good way to write in a concatenative style in Javascript - I don't think it's necessary. You can use the style without the paradigm. (Besides, the reference implementation of Joy mutates the underlying stack variable, and if the way to get a concatenative paradigm in standards-compliant, runs-in-a-browser Javascript is to Greenspun's Tenth Law a concatenative language...)

The better option would've been not to use a stack at all, and illustrate it with integers, as you've done here. But you'd still need some way to manage multiple variables to use a concatenative idiom to compute 2x^y.

>Also your examples literally defeat the purpose of functional and concatenative programming. It makes the code worse.

Right. You can follow the rules of the paradigm in Javascript, once you've written enough of an interpreter for a concatenative language to let you do so, but it'll make your code worse. But there are languages that are designed for the paradigm - and in them, you can write good code that follows the rules of it.

>Javascript has been giving bootcampers completely wrong ideas about functional programming and what it is. Learn a real functional programming lang to actually get it. Haskell is a good one.

Not a bootcamper - even worse, I work in a warehouse - but I might quit and become one once my stock options vest...

Re:Why Concatenative Programming Matters (2012) on Tuesday April 16, 2019 @07:02AM (#19672580)
It's technically possible to write in a concatenative style in a non-concatenative language, but in most cases, it's nowhere near idiomatic. How would you define a function that squares a number in a concatenative style in Javascript?

Here's the best I can come up with:

  function compose(...funcs) {
    return stack => funcs.reduce((acc, cur) => cur(acc), stack)
  }

  function dup(stack) {
    stack.push(...[,,].fill(stack.pop()))
    return stack;
  }

  function mul(stack) {
    stack.push(stack.pop() * stack.pop())
    return stack;
  }

  const square = () => compose(dup, mul)

  console.log(square()([4]))
Then again, this could be a trick question someday - if the pipeline proposal goes through, it'll be possible to write idiomatic concatenative Javascript. (If you want to play with the pipeline operator, see here: https://defseg.io/etc/pipeline.html) You'd still need to define all your functions as accepting a stack parameter, but you wouldn't need a compose function, so you could do something like this:

  function dup(stack) {
    stack.push(...[,,].fill(stack.pop()))
    return stack;
  }

  function mul(stack) {
    stack.push(stack.pop() * stack.pop())
    return stack;
  }

  const square = stack => stack |> dup |> mul

  console.log([4] |> square)
  console.log([2] |> square |> square)
Now to write an ECMA proposal for recursive combinators... /s
Re:Why Concatenative Programming Matters (2012) on Tuesday April 16, 2019 @05:41AM (#19672297)
Wikipedia tends to be technical about math/CS subjects. In other fields, you can use it as a textbook for a 101 course - I once heard of an astronomy professor who did this, and this is what I recommend people do with linguistics. (Except syntax, which, as the most CS-adjacent subfield, gets the most technical treatment.)

The page for Joy, Manfred von Thun's concatenative language, is a little better:

> Joy is unusual ... in its ... lack of formal parameters.

So, where in a standard ALGOL- or C-type language, you'd define a function that squares a number like this:

  def square(x):
    return x * x
And in Haskell... OK, I don't know Haskell, but if I click through tryhaskell.org a bit, I see this:

  let square x = x * x in square 2
But in Joy, the way to write a function that squares a number doesn't involve explicit references to parameters at all:

  dup *
Or, if you want to name your function:

  DEFINE square == dup *.
Every function takes a stack and returns a stack. `dup` takes a stack [A B C...] and returns [A A B C...], for any values of A, B, and C. `` takes a stack [A:int B:int C...] and returns [AB C...].

Now, Joy in particular was written as a research language about recursive combinators. So a mostly-idiomatic* factorial function in Joy looks like this:

  DEFINE fac == 
    [0 =]
    [1 +]
    [dup 1 -]
    [*]
    linrec.
And then you call that with `5 fac` or something.

The neat thing about this is that you don't need to define functions and reference them from inside themselves in order to get recursion, and you can write code that's a little more legible than using the Y combinator for everything. You could also write something like this:

  DEFINE fac-explicit-recursion ==
    [0 =]
    [pop 1]
    [dup 1 - fac-explicit-recursion *]
    ifte. 
But you don't have to.

`linrec` is a function that expects four quoted functions as the top elements on the stack. It executes the first function; if that 'returns' true, it executes the second one and stops, and if not, it executes the third function, recurses, and then executes the fourth.

A while ago, I started working on a Joy interpreter in the browser. I haven't gotten around to finishing it yet, but it's at least working well enough that you can (hopefully) step through the https://defseg.io/joyjs/

For a flashier example (which won't work there right now, because I haven't implemented... `binrec`... yet), here's quicksort:

  [size 1 <=]
  []
  [uncons [>] split]
  [[swap] dip cons concat] 
  binrec
`binrec` is another recursive combinator that expects four quoted functions. It handles the first two functions there the same way as `linrec` - executes the first (here, "does this list have one or fewer elements?"), and if true, executes the second (here, do nothing).

But if the condition is false, it executes the third function to produce two values, recurses on both, and then uses the fourth function to combine them. So you get your pivot, split your list, recurse on both lists, and then stitch the two result lists and the pivot back together in sorted order.

* 'Mostly' because you'd actually write `[null] [succ] [dup pred] [*] linrec`, but the two functions are identical. (`null` is overloaded to also test for zero elements in an aggregate, but if you pass it an aggregate it'll throw a type error anyway.) Similarly for quicksort: `[small] [] [uncons [>] split] [enconcat] binrec`.

Re:Defender of the Favicon (2008) on Wednesday February 27, 2019 @01:02PM (#19265370)
I couldn't figure out how to play this, so I tried making Snake in the favicon: https://defseg.io/snavicon

The framerate isn't great - is drawing to the favicon inherently slow, or can it be improved? - but it's at least somewhat playable.