sรธren peter mรธrch

prologic (twtxt.net)

Problems are Solved by Method\" ๐Ÿ‡ฆ๐Ÿ‡บ๐Ÿ‘จโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿฆฏ๐Ÿนโ™” ๐Ÿ“โšฏ ๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ง๐Ÿ›ฅ -- James Mills (operator of twtxt.net / creator of Yarn.social ๐Ÿงถ)

prologic (twtxt.net)

@klaxzy That set is the set of users that actually interact with one another. The "Twtxt" feed set is a bit larger, but mostly just "walls of posts" and little to no inteaction. So yeah, the real community is quite small sadly ๐Ÿ˜…

In reply to: #nf2oalzwzje5 3 months ago
prologic (twtxt.net)

Too much information? ๐Ÿค”

In reply to: #77esnerllxtg 3 months ago
prologic (twtxt.net)

@arg You actually can, but we highly discourage it and I haven't really built "Edit" / "Delete" functionality in the Twtxt App that I know you're using ๐Ÿ˜… Twtxt being purely decentralised, meaning that there are absolutely zero decentralised, with the exception of the twtpub.com service you're using to reduce as much friction as possible for newcomers to try things, makes supporting threads a bit of a controversial topic ๐Ÿ˜† -- In the end we are sticking with the Hash v2 extension, making threads use content addressing, so even if you did delete/edit a Twt, you have to be carefuly it hasn't already been replied to in the ecosystem ๐Ÿคฃ

In reply to: #77esnerllxtg 3 months ago
prologic (twtxt.net)

@murad Yes things do work ๐Ÿคฃ

In reply to: #6uvxjo3jmlb6 3 months ago
prologic (twtxt.net)

@murad Welcome to Yarn.social / Twtxt ๐Ÿฅณ You might want to fiddle a bit with your settings, maybe a nice avatar, description, maybe a few links, etc ๐Ÿ˜ƒ

Read replies 3 months ago
prologic (twtxt.net)

What's interesting here... Which is the interesting thing about Mu is the dual runtime. So the above solution for Euler Problem 9 finds the solution in ~429ms with the Go VM and ~327ms natively compiled to darwin/arm64. Not bad for a language I haven't really done any optimization work on yet (correctness first obviously).

In reply to: #tz4dru7nwzct 3 months ago
prologic (twtxt.net)

Oh man wow ๐Ÿ˜ฎ Problem 9 was quite hard ๐Ÿ˜ฑ I had to build two new functions in the Mu stdlib for computing combinations and permutations, but then the combinations of range(1000) for triples such as a + b == c is enormous! So i had to write iterator versions of these to do lazy evaluation. Anyway solution follows:

#!/usr/bin/env mu

// Special Pythagorean Triplet

import "iter"

fn usage() {
  print("Usage:", args()[0], "<n>")
}

fn sqr(x) { x * x }

fn main() {
  if len(args()) < 2 {
    usage()
    exit(1)
  }

  n := must(int(args()[1]))
  print("n:", n)

  // For a < b < c and a + b + c == n, both a and b are strictly less
  // than n/2. Generate only (a,b) combinations and derive c directly. This
  // keeps the search lazy and reduces n=1000 from C(999,3) = 165,668,499
  // candidate triples to C(499,2) = 124,251 candidate pairs.
  pairs := iter.combinations(iter.range(1, n / 2), 2)

  triples := iter.map(pairs, fn(xs) {
    a := xs[0]
    b := xs[1]
    return [a, b, n - a - b]
  })

  // Enforce b < c; a < b is already guaranteed by combinations over an
  // increasing range, and a + b + c == n holds by construction.
  triples = iter.filter(triples, fn(xs) {
    return xs[1] < xs[2]
  })

  // Euler 9 has one answer for n=1000. find() stops the entire upstream
  // iterator chain as soon as the first Pythagorean triple is found.
  answer := iter.find(triples, fn(xs) {
    return sqr(xs[0]) + sqr(xs[1]) == sqr(xs[2])
  })

  print(answer)

  if answer != nil {
    print(answer[0] * answer[1] * answer[2])
  }
}

main()
In reply to: #tz4dru7nwzct 3 months ago
prologic (twtxt.net)

It is such a nice feeling that Mu is such a capable little language ๐Ÿ˜… And I decided to write code code in Mu by hand ๐Ÿคš haha ๐Ÿคฃ and start solving Project Euler problems, like Problem 8 which works out to be a nice elegant solution in Mu:

#!/usr/bin/env mu

// Largest Product in a Series

import "fp"
import "sys"

fn usage() {
  print("Usage: cat |", args()[0], "<n>")
}

fn products(xs) {
  return fp.reduce(xs, 1, fn(x, y) {
    if y == nil {
      return x
    }
    return x * y
  })
}

fn main() {
  if len(args()) < 2 {
    usage()
    exit(1)
  }

  s := must(sys.read_all(0))
  if len(s) == 0 {
    usage()
    exit(1)
  }

  n := must(int(args()[1]))
  r := fp.max(fp.map(fp.sliding(fp.map(s, int), n), products))
  print(r)
}

main()
Read replies 3 months ago
prologic (twtxt.net)

but yes, however you cannot currently add it or delete post via the app as I haven't really built that feature at the moment you technically can do it, but you do run into some challenges with breaking threads if you've already published something and then go back and edit it so we generally advise not to do that too much if you can help it

In reply to: #fzla7l7wxjcf 3 months ago
prologic (twtxt.net)

@movq No I haven't :/

Just out of curiosity, have you ever ran this on real hardware? ๐Ÿ˜ƒ

Only QEMU. Would you like to help test it on real hardware? ๐Ÿ˜… I'm not sure I have anything worth testing it on!

In reply to: #b66k5i2o5myu 4 months ago
Reply via email