Hacker News new | past | comments | ask | show | jobs | submit login

While it's not quite the same, we can create a short makefile.

  vixen: rudolph prancer dasher cupid blitzen
   echo vixen

  dancer : vixen donder blitzen rudolph cupid dasher
   echo dancer

  comet: vixen cupid prancer rudolph
   echo comet

  donder: comet vixen dasher prancer cupid blitzen rudolph
   echo donder

  cupid: prancer
   echo cupid

  blitzen: cupid dasher
   echo blitzen

  rudolph: cupid prancer
   echo rudolph

  dasher: rudolph prancer
   echo dasher

  prancer: ;
   echo prancer

  order: vixen dancer comet donder cupid blitzen rudolph dasher prancer
   echo Get in Line
Then: make -n order

outputs:

  echo prancer
  echo cupid
  echo rudolph
  echo dasher
  echo blitzen
  echo vixen
  echo comet
  echo donder
  echo dancer
  echo Get in Line
Which, for me, is:

  real 0m0.015s
  user 0m0.003s
  sys 0m0.006s



There's also the dedicated unix utility "tsort" (https://en.wikipedia.org/wiki/Tsort) although actually your makefile is more succinct.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: