prologic

twtxt.net

Problems are Solved by Method\" 🇦🇺👨‍💻👨‍🦯🏹♔ 🏓⚯ 👨‍👩‍👧‍👧🛥 -- James Mills (operator of twtxt.net / creator of Yarn.social 🧶)

↳ In-reply-to » 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:

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()

⤋ Read More

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 More
↳ In-reply-to » The original twt is unavailable. It may have been edited or deleted, or is from an unknown or muted feed.

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

⤋ Read More
↳ In-reply-to » The original twt is unavailable. It may have been edited or deleted, or is from an unknown or muted feed.

@brytboi@twtpub.com I hope you’re seeing my replies because you absolutely can scroll up in the app. Let me know if you’ve run into a bug though and report it to me so I can fix it immediately!

⤋ Read More
↳ In-reply-to » @david Do you mind re-testing too with the updates i just pushed out? 🙏

I’m not seeing any of what you’re describing, But then again I only use the app on mobile, on iPhone. There’s only been basically a few commits to the App and one to Swag. That’s it.

⤋ Read More
↳ In-reply-to » The original twt is unavailable. It may have been edited or deleted, or is from an unknown or muted feed.

@GabesArcade@gabesarcade.com Not sure if @mariam@twtpub.com will ever see or respond to our welcomes tbh 😢 I caught the new user trying out the Twtxt App 4 days too left 🤦‍♂️ – I think I need to make some improvements to the app, some nudges, something to encourage users to stick around? Maybe some periodic push notifications? 🤔

⤋ Read More

@david@daiwei.me Also if you wouldn’t mind writing up an Issue for the image/upload problem too, that would be great 👍 I still haven’t solved it properly, but I’ll try to do so today. There’s also an issue uploading images via the yarnd API path from the Twtxt App too, which I can replicate with basically any photo from my iPhone’s Photo gallery hmm 🤔

⤋ Read More

I really do find it difficult to follow anyone that basically posts to a wall, or doesn’t follow back. It’s utterly pointless not being able to have a conversation, like basically, at all. Maybe it’s not even anyone’s fault? Maybe just a sucky client that doesn’t understand how User-Agent works in Twtxt Discovery? 💡

⤋ Read More
↳ In-reply-to » So... my little experimental Mu (µ) OS is now ~8.7k of Mu and ~2k of Assembly, which makes this about an ~80/20 split. I've managed to achieve most of the goals I had set out, by ensuring a tiny Nucleus of only ~2k Assembly and all Policy, Services and Userland written entirely in Mu (a language I also deisnged and created, which still has no support for floats LOL)

@movq@www.uninformativ.de 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!

⤋ Read More
↳ In-reply-to » https://youtu.be/Q9uefFYe6bM

@thecanine@twtxt.net This is of course disgusting! I have first hand experience with my neighbors next door where I told them about one of their LG (older models) “spying” on what they were watching. I’ve of course since blocked that shit™ at the network level for them, But man, don’t ever buy LG. In fact don’t ever buy any of this “Smart” shit™. Period.

⤋ Read More

So… my little experimental Mu (µ) OS is now ~8.7k of Mu and ~2k of Assembly, which makes this about an ~80/20 split. I’ve managed to achieve most of the goals I had set out, by ensuring a tiny Nucleus of only ~2k Assembly and all Policy, Services and Userland written entirely in Mu (a language I also deisnged and created, which still has no support for floats LOL)

⤋ Read More