HSL ~2022.2 %hw8
Homework #8 for Hoon School Live.

L'état, c'est moi.  (Louis XIV)

You should choose EITHER Q1 OR Q2 to complete this time.   You don't need to complete both.

This is the hardest homework in HSL.  IT IS NOT A WEEDER HOMEWORK  If you are stuck, ask in office hours.  You've made it this far, you'll make it through to the end.
adam.malin@thechristophgroup.org Switch account
Email *
Q0. What is your planet or comet?  (Type "our" in the Dojo of your ship to identify if you're not sure—your ship, not your fakeship.) *
Parsing arithmetic expressions
::  expr-parse: parse arithmetic expressions
::
|=  math=tape
|^  (scan math expr)
++  factor
  %+  knee  *@ud
  |.  ~+
  ;~  pose
    dem
    (ifix [pal par] expr)
  ==
++  term
  %+  knee  *@ud
  |.  ~+
  ;~  pose
    ((slug mul) tar ;~(pose factor term))
    factor
  ==
++  expr
  %+  knee  *@ud
  |.  ~+
  ;~  pose
    ((slug add) lus ;~(pose term expr))
    term
  ==
--
Q1. Add exponentiation to the arithmetic expression parser in the Parsing guide at https://urbit.org/docs/hoon/guides/parsing#recursive-parsers.  Give the entire gate as your answer here.
Gleichniszahlenreihe
Gleichniszahlenreihe, or the look-and-say sequence, is constructed from an aural description of a sequence of numbers.

Consider the sequence of numbers that begins with `1, 11, 21, 1211, 111221, 312211, 13112221, ...`.  Each number in the sequence represents what would result if the digits in the preceding value were counted and spoken aloud.  For instance, "1" yields "one 1 → 11"; "11" yields "two 1s → 21"; "21" yields "one 2, one 1 → 1211", and so forth.  The next number in the sequence after "13112221" is thus "one 1, one 3, two 1s, three 2s, one 1 → 1113213211".

This is a fairly complicated program.  You need a few parts:  the ability to take a tape and parse it into components, the ability to count components, and the ability to produce a new tape.  Then a recursing bit to produce a list of these values and (ultimately) return the last one.  Think about the Caesar cipher's structure.
Q2. Compose a `%say` generator which carries out the look-and-say sequence calculation for a given input.  The input should be a number which indicates which value in the sequence is desired (e.g. 1→1, 2→11, 3→21).  Some good hard thinking with a pencil and paper may be helpful. *
Q3. What are your biggest remaining concerns, points of misunderstanding or fuzzy understanding, or other feedback on Lesson 8?
A copy of your responses will be emailed to the address you provided.
Submit
Clear form
Never submit passwords through Google Forms.
reCAPTCHA
This form was created inside of Tlon Corporation. Report Abuse