News for hackers. Stuff that matters.
Re:Reaching the Unix Philosophy's Logical Extreme with WebAs... by Drakim on Monday August 28, 2023 @05:30PM (#37300648)
Only if the NAND gate is expressed as a file
Re:Reaching the Unix Philosophy's Logical Extreme with WebAs... by Waterluvian on Monday August 28, 2023 @05:33PM (#37300672)
Okay… please… someone implement ‘nand’ and write a script that does something simple using only it.
Re:Reaching the Unix Philosophy's Logical Extreme with WebAs... by scarmig on Monday August 28, 2023 @05:35PM (#37300697)
nand.sh

  A_DIR="./A"
  B_DIR="./B"
  OUTPUT_DIR="./OUTPUT"
  FILENAME="input.txt"

  if [ -f "$A_DIR/$FILENAME" ] && [ -f "$B_DIR/$FILENAME" ]; 
  then
      rm -f "$OUTPUT_DIR/$FILENAME"
  else
      touch "$OUTPUT_DIR/$FILENAME"
  fi
Re:Reaching the Unix Philosophy's Logical Extreme with WebAs... by jewel on Monday August 28, 2023 @06:36PM (#37301264)
Sure! Here's an implementation of nand and a 2-bit adder that uses it: https://github.com/jewel/nand
Re:Reaching the Unix Philosophy's Logical Extreme with WebAs... by Waterluvian on Monday August 28, 2023 @06:48PM (#37301376)
Hah this is awesome!

I’m going to poke around and see how much it would take to stretch this into a basic Turing machine emulator.

Re:Reaching the Unix Philosophy's Logical Extreme with WebAs... by hmcq6 on Monday August 28, 2023 @07:13PM (#37301535)
Re:Reaching the Unix Philosophy's Logical Extreme with WebAs... by thaumasiotes on Monday August 28, 2023 @07:44PM (#37301730)
Great find. People who like this might also like http://incredible.pm/ .

I don't know how I feel about the message "This is optimal!" displaying when you use one NAND gate to build an inverter at level 2. Level 1 forces you to build an NAND gate out of (1) an AND gate, plus (2) an inverter. It feels like it'd be more optimal to just reuse that inverter.

(And then level 3 is an AND gate, the other primitive† you started with...)

† Technically, you start with two primitives, implementing f(a, b) = a ∧ b and g(a,b) = ¬(b ⟶ a). You also get the ability to provide 0 and 1 as fixed inputs, thus ¬a ≡ g(a,1). What you lose after implementing the NAND gate is the ability to provide a fixed 1 input - instead, you are informed that you assume all gates automatically draw from this. Worst of all possible worlds.

Re:Reaching the Unix Philosophy's Logical Extreme with WebAs... by porridgeandrice on Tuesday August 29, 2023 @04:32AM (#37304856)