Newbie 1909 | Scheme | Over

For Newbie Games, which have a set format and experienced moderators. Archived during the 2023 queue overhaul.
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Newbie 1909 | Scheme | Over

Post Post #0 (isolation #0) » Mon Dec 24, 2018 7:53 pm

Post by Plotinus »

Newbie 1909 | Scheme


Image



Hello. In this game I'll be introducing a computer language called Scheme, which has a very simple syntax that you can learn in a couple days. If you're using Linux you may already have Guile installed, in which case you're good to go. If you're on another system you might want to try another interpreter/compiler. Such as Ikarus for OSX or Chez Scheme on Windows
.



Moderated by Plotinus


Original Playerlist:
  1. 1) Water Guard
    2) Cyndiac
    3) Emperor flippyNips
    4) dicideaq
    5) EGL
    6) Amzela
    7) Loopdan (SE)
    8) Clemency (SE)
    9) teacher (IC)
Spoiler: Game Reveals (9)
  1. 4) dicideaq1, mafia goon, lynched day 1

    7) Loopdan (SE), vanilla townie, killed night 1, but won posthumously!
    1) Child1
    replaces ZombieStriker, who never opened their role PM; Water Guard, who never opened their role PM
    , vanilla townie, lynched day 2, but won posthumously!

    3) Emperor flippyNips1, mafia rolecop, lynched day 3

    2) u r a person 2
    replaces Dell, who never opened their role PM; Cyndiac, who never opened their role PM
    , vanilla townie, survived and won!
    5) EGL, vanilla townie, survived and won!

    6) Amzela1, town doctor, survived and won!
    8) Clemency (SE), town neapolitan, survived and won!

    9) teacher (IC), vanilla townie, survived and won!


Spoiler: Spectators (1)
  • hubris


Events - Day 1 starts; ZombieStriker replaces Water Guard; Dell replaces Cyndiac
- Child replaces ZombieStriker
- u r a person 2 replaces Dell
- dicideaq is lynched, day 1 ends

- Loopdan is killed, Day 2 begins
- Child is lynched, day 2 ends

- Nobody is killed, day 3 begins
- emperor flippyNips is lynched, game ends
- Game Events, Game Links, post game commentary
Last edited by Plotinus on Tue Jan 08, 2019 7:54 am, edited 11 times in total.
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #1 (isolation #1) » Mon Dec 24, 2018 8:35 pm

Post by Plotinus »

Rules


Inspired by Equinox's, Glork's and Ether's rulesets.

important bit
  • Day 1: up to 10 days, Day 2+ up to 7-days, Night: 48 hours.
  • Majority lynches
  • 36 hours before prod, 24 hours before replacement, 24 hour weekends
  • Bah posts allowed (limit: 1, free of game related content)
  • I have some unusual rules about animated GIFs, tiny text, and prodging. Scroll down for details.
  • Don’t be a dick

  1. Follow all site rules.

  2. Mod colour
    – My mod colour is
    grey
    ; don't use it.
  3. Behaviour
    - Don’t be a dick. This is a heated game but toxicity will not be tolerated. Attack the play not the player. If your fellow players tell you to stop, you must stop. If you do not stop, I will tell you to stop. If you still do not stop, you will be force-replaced. Asking people to stop voting you or to stop scumhunting you entirely doesn't count for this rule and you may find yourself lynched if you try it.
  4. Don't talk about ongoing games
    - You may not talk to each other about this game outside of threads I have created for this purpose. You may not talk about other ongoing games in this thread.
  5. Animated GIFs
    - are of the devil, but they are permitted behind spoilers if clearly labelled as such.
  6. Tiny text
    - is also of the devil, keep it 70+ please.
  7. Provable randomness
    - is against the rules. Saying that you rolled a dice is fine, using dice tags or random.org is not.
  8. Claiming scum
    - by yourself is fine. Claiming scum with another player is against the rules.
  9. Cryptography
    - is forbidden. Breadcrumbing is okay.
  10. Confirmation
    - You have about 72 hours to confirm your role and your alignment by PM. Game will start sooner if everyone confirms. Posting in a private topic counts as confirmation.
  11. Days
    - Day 1 lasts 10 days and other days last 7 days. Extensions may be granted if there are replacements, or if the majority of players make it clear to me that an extension is desired.
  12. Activity
    - You must post at least once every 36 hours or I will Prod you. You then have 24 hours to post in the game thread or I will replace you. If you come back before I find a replacement, you can stay. The activity timers run at half-speed on weekends. Players can request me to prod somebody early. This will only count as an official prod if you don't post before you would have been due for a prod. If you haven't posted in the 24 hours before the thread is locked for night, you must reply to the night start PM or you will be replaced during the night.
  13. Vacation/Limited Access
    If you need to be absent for longer than this, you should declare
    V/LA
    in bold in the thread like this: [
    b]
    @Mod: I will be v/la until Thursday
    [
    /b]. While you are V/LA, you will be nudged once every 54 hours. Two nudges equals one prod. If you have not posted game advancing content in 5 days, regardless of V/LA status, you will be replaced.
  14. Prodging
    - A naked "prod dodge" does not reset the prod timer. To avoid being prodded/replaced for inactivity, include some game advancing content in your prodges, such as "got prodded; xxxx is still scum."
  15. Quoting
    - You may not quote (or copy paste) any private information into the thread, including your role PM and any mod communication.
  16. Voting
    - Votes must be in bold in the format VOTE: Plotinus or
    Vote: Plotinus
    . Strong preference for using vote tags instead of bold tags. Unvotes are nice but not required. If I think it’s a vote, it’s a vote, no tricks. Type [
    v]Plotinus[
    /v] to vote and [
    uv]Plotinus[
    /uv] to unvote.
  17. Lynching
    - Days end early when a simple majority of players (50% of living players + 1 rounded down) vote to lynch somebody. If a majority is not reached at deadline or if a majority of the players vote for no lynch, the day will end without a lynch. At evens, 50% is sufficient for no lynch.
  18. Twilight
    - Begins when a majority is reached and lasts until I lock the thread. You're still alive until I flip you so you can talk in any game threads you have access to until then, but no votes or unvotes will be counted.
  19. Night
    - Night lasts at least 48 hours. The night phase can be shortened if every living player -- even those with no night actions -- agrees to it and if I'm not busy.
  20. Action submissions
    - You may submit actions via PM (if town) or PT (if scum). If the actions are not submitted by the deadline then you do nothing. You can change your mind as many times as you like before the deadline.
  21. Reminders
    - If I don't hear from you about your night actions, I'll PM you 24 hours before the deadline. This doesn't count as a prod. If I still don't hear from you, you will take no action.
  22. Play to win
    - this particular game, not some future one, and keep it fun!
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #2 (isolation #2) » Mon Dec 24, 2018 8:36 pm

Post by Plotinus »

Newbie Setup

2d3 (as designed by Cabd):


ABC
Mafia
Mafia Roleblocker
Mafia Rolecop
Mafia Goon
Row 1
Town Cop and Town Neapolitan
Town Cop and Town Tracker
Town Cop and Vanilla Townie
Row 2
Town Jailkeeper and Town Doctor
Town Jailkeeper and Town Tracker
Town Jailkeeper and Vanilla Townie
Row 3
Town Cop and Town Doctor
Town Neapolitan and Town Doctor
Town Tracker and Town Doctor

Each Newbie Game will be given a setup that incorporates one mafia role from the top of a column, and then two town roles from a row below the selected mafia role. The remaining six roles will be filled in by
one mafia goons
and
five vanilla townies
appropriately, to create a
2-mafia
and
7-town
setup.

All Newbie games use the Natural Action Resolution system for determining Night action effects.
Mafia Roleblocker
action takes precedence over a
Town Jailkeeper
action should that apply.

Mafia can communicate in their Private Topic at all times.

Spoiler: Full Setups
Column A & Row 1:
Mafia Roleblocker, Mafia Goon, Town Cop, Town Neapolitan, Vanilla Townie x 5
Column A & Row 2:
Mafia Roleblocker, Mafia Goon, Town Jailkeeper, Town Doctor, Vanilla Townie x 5
Column A & Row 3:
Mafia Roleblocker, Mafia Goon, Town Cop, Town Doctor, Vanilla Townie x 5
Column B & Row 1:
Mafia Rolecop, Mafia Goon, Town Cop, Town Tracker, Vanilla Townie x 5
Column B & Row 2:
Mafia Rolecop, Mafia Goon, Town Jailkeeper, Town Tracker, Vanilla Townie x 5
Column B & Row 3:
Mafia Rolecop, Mafia Goon, Town Neapolitan, Town Doctor, Vanilla Townie x 5
Column C & Row 1:
Mafia Goon x 2, Town Cop, Vanilla Townie x 6
Column C & Row 2:
Mafia Goon x 2, Town Jailkeeper, Vanilla Townie x 6
Column C & Row 3:
Mafia Goon x 2, Town Doctor, Town Tracker, Vanilla Townie x 5


Spoiler: Role PMs
Vanilla TownieWelcome!

You are a
Vanilla Townie
.

You have no special abilities.

You win when all threats to the Town have been eliminated.


The game thread is here.

Confirm by replying with your role name and alignment.

Town JailkeeperWelcome!

You are a
Town Jailkeeper
.

You may target one player per night phase. This player will be protected from kills and be prevented from using their own action, if they have one, during that night phase. You cannot target yourself.

You win when all threats to the Town have been eliminated.


The game thread is here.

Confirm by replying with your role name and alignment.

Town CopWelcome!

You are a
Town Cop
.

You may target one player per night phase. At the end of the night phase, you will be informed if they are
Town
or
Mafia
. If you are roleblocked, you will receive no result.

You win when all threats to the Town have been eliminated.


The game thread is here.

Confirm by replying with your role name and alignment.

Town NeapolitanWelcome!

You are a
Town Neapolitan
.

You may target one player per night phase. At the end of the night phase, you will be informed if they are
Vanilla Townie
or
Not Vanilla Townie
. If you are roleblocked, you will receive no result.

You win when all threats to the Town have been eliminated.


The game thread is here.

Confirm by replying with your role name and alignment.

Town TrackerWelcome!

You are a
Town Tracker
.

You may target one player per night phase. At the end of the night phase, you will be informed what player or players they targeted with their action, if any. If you are roleblocked, you will receive no result.

You win when all threats to the Town have been eliminated.


The game thread is here.

Confirm by replying with your role name and alignment.

Town DoctorWelcome!

You are a
Town Doctor
.

You may target one player per night phase. This player will be protected from kills during that night phase. You cannot target yourself.

You win when all threats to the Town have been eliminated.


The game thread is here.

Confirm by replying with your role name and alignment.




Mafia GoonWelcome!

You are a
Mafia Goon
.

You and your partner share a factional kill each night. You must choose which of you will commit the kill. You also share a factional PT, located here, where you may talk at any time.

You win when the Town has been eliminated, or nothing can stop this from occurring.


The game thread is here.

Confirm by replying with your role name and alignment or by posting in your PT.

Mafia RolecopWelcome!

You are a
Mafia Rolecop
.

You may target one player per night phase. At the end of the night phase, you will be informed of their role but not their alignment.
Vanilla Townies
and
Mafia Goons
will both return "Vanilla". If you are roleblocked, you will receive no result.

You and your partner share a factional kill each night. You must choose which of you will commit the kill. You may commit the kill and perform a role cop in the same night phase. You also share a factional PT, located here, where you may talk at any time.

You win when the Town has been eliminated, or nothing can stop this from occurring.


The game thread is here.

Confirm by replying with your role name and alignment or by posting in your PT.

Mafia RoleblockerWelcome!

You are a
Mafia Roleblocker
.

You may target one player per night. This player will be prevented from performing their own action, if any.

You and your partner share a factional kill each night. You must choose which of you will commit the kill. You may commit the kill and perform a roleblock in the same night phase. You also share a factional PT, located here, where you may talk at any time.

You win when the Town has been eliminated, or nothing can stop this from occurring.


The game thread is here.

Confirm by replying with your role name and alignment or by posting in your PT.
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #3 (isolation #3) » Mon Dec 24, 2018 8:36 pm

Post by Plotinus »

All role PMs have been sent out (in the order of the signup list so timestamps mean nothing)! We will start in (expired on 2018-12-27 08:45:00) or when [8/9] people have confirmed, whichever happens sooner.

The above clock and any others used throughout this game will be accurate from the time you loaded the page.
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #4 (isolation #4) » Mon Dec 24, 2018 10:19 pm

Post by Plotinus »

At least one person wants to know if you need to download anything to play this game. The answer is no. In newbie games, and most other games on this site, the flavour is just for fun and you can ignore it entirely. Even in theme games, we try to make them playable to people who don't care about the flavour.

If you're not interested in learning an obscure programming language, then don't install anything and when reading the vote counts, just scroll down to the part outlined in red. That's where the votes will be.
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #5 (isolation #5) » Wed Dec 26, 2018 8:45 pm

Post by Plotinus »

Official Vote Count 1.00 Parentheses and Polish Notation
Scheme is a dialect of Lisp, which stands for Lost In Stupid Parentheses. Just kidding, it stands for LISt Processor. Any good text editor can automatically make the parentheses be different colours so you don't get lost.

In Scheme, everything has something that it is and something that it does. For example,
+
is a procedure named
+
. It takes an optional amount of numbers, and what it does is add those numbers together. When you're writing your own procedures, it's important to give them really obvious names like
+
so that it's obvious what your procedure actually does.

Suppose I type
+ 1 2
into the prompt:

Code: Select all

scheme@(guile-user)> + 1 2
$1 = #<procedure + (#:optional _ _ . _)>
$2 = 1
$3 = 2


This tells me that + is a procedure named + that takes an optional list of operands, and that 1 and 2 are (integers) named 1 and 2.

If I want to learn the sum of 1 and 2, I need to put it in parentheses. An open parentheses means "evaluate this procedure" and a close parentheses shows Scheme where the procedure and its operands ends.

(+ 1 2)


Code: Select all

scheme@(guile-user)> (+ 1 2)
$4 = 3


You now know almost everything you need to know about scheme's syntax: Open parentheses: evaluating a thing. Lack of parentheses: referring to the thing by name.

You might notice that the command is
(+ 1 2)
not
(1 + 2)
. This is called Polish notation and it means the procedure always goes first and then everything after that are the things the procedure is working on. A benefit of Polish notation is that instead of writing
(2 *
(1 + 2 + 3 + 4 + 5 + 6)
)
you can write
(* 2
(+ 1 2 3 4 5 6)
)
.




LynchingWith 9 votes in play, it takes 5 to lynch.

Everybody
(0): Nobody

Not Voting
(9): Amzela, Clemency, Dell, dicideaq, EGL, Emperor flippyNips, Loopdan, teacher, ZombieStriker

Deadline:
(expired on 2019-01-06 08:45:00).


Mod notes:
Good luck everyone!

Water Guard and Cyndiac never opened the role PMs I sent them. They are replaced by ZombieStriker and Dell respectively.

ZombieStrikes and Dell have another (expired on 2018-12-29 08:45:00) to confirm before they too will be replaced.

Please take a moment to familiarise yourselves with my ruleset because I have some rules you may not have encountered in other games before regarding animated gifs, tiny text, prodging and perhaps some other things.[/area]
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #24 (isolation #6) » Thu Dec 27, 2018 8:03 am

Post by Plotinus »

(1+ page)
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #25 (isolation #7) » Thu Dec 27, 2018 8:03 am

Post by Plotinus »

Official Vote Count 1.01 (define)
In Scheme, we have a way to define a procedure or a variable. The procedure for this is called
(define)


scheme@(guile-user)>
(define players 9)

scheme@(guile-user)> players
$1 = 9


So I have created a variable, named it players, and set its value to be a pointer to the concept of nineness, which is represented by the symbol 9, which is built in Scheme. We didn't have to
(define 9
(+ 1 1 1 1 1 1 1 1 1)
)
ourselves. This means that 9 is a primitive: something the language already knows that we don't have to teach it.

In practice, for speed, integers don't take up a lot of space and so the compiler has an optimisation to just write the bytes into the variable itself rather than use a pointer, but you don't have to worry about that programmatically; you can conceptualise it in your head that everything is a pointer and thinking about it like this won't lead you astray.

We can also define a procedure like this:

(define
(square x)
(* x x)
)


Notice that
(square x)
is surrounded by parentheses. This means that
square
is a procedure, not a variable.
x
is the variable that
square
operates on. The next set of parentheses defines what it does:
(* x x)
- it returns the product of x and x.

If we type it into the interactive prompt, it gives us the answer immediately:
scheme@(guile-user)>
(square 361)

$3 = 130321


What happens if we leave off the parentheses? In the case we are asking it dereference the pointers (e.g. "Saying what is that?") that are in
square
and
361
:

scheme@(guile-user)> square 361
$4 = #<procedure square (x)>
$5 = 361


What is square? It is a procedure named square that works on a variable x. What is 361? It is the number 361.

Remember that parentheses mean "evaluate the procedure" and lack of parentheses mean "dereference the pointer".


When I first started playing with scheme I spent a while wondering how to get a procedure to return something. The answer is quite elegant: a procedure always automatically returns the obvious thing for it to return. In our procedure
(square x)
, we returned the product of x and x.

In the interactive prompt, it's understood that you'll just be playing around, so it is okay to do this:

scheme@(guile-user)>
(define players 9)

scheme@(guile-user)> players
$1 = 9
scheme@(guile-user)>
(define players 7)

scheme@(guile-user)> players
$6 = 7


In a scheme program, however, this is an error.
(define)
is for creating a variable-or-procedure out of nothing and allocating memory for it. It is not for renaming things. We might get to variable reassignment later but you'd be surprised how many things we can do without it.




LynchingWith 9 votes in play, it takes 5 to lynch.

dicideaq
(2): Loopdan, Clemency
Loopdan
(2): teacher, Amzela

Not Voting
(5): EGL, Dell, dicideaq, ZombieStriker, Emperor flippyNips

Deadline:
(expired on 2019-01-06 08:45:00).


Mod notes:
ZombieStrikes and Dell have another (expired on 2018-12-29 08:45:00) to confirm before I start looking for a replacement.[/area]
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #52 (isolation #8) » Thu Dec 27, 2018 10:31 am

Post by Plotinus »

Official Vote Count 1.02 evaluation
We defined square in the last votecount.

(define
(square x) (* x x)
)


Now we can use it just the way we would use * or +, nested to arbitrary levels of depth like:

(square
(square
(square
(square
(square 4)
)
)
)
)
18446744073709551616


And we can use it in new procedures like:

(define
(difference-of-squares x y) (-
(square x) (square y)
)
)


What really happens when we type
(difference-of-squares
(square 5) (square 4)
)
?

Well, first it expands it out:

(difference-of-squares
(* 5 5) (* 4 4)
)


And then it expands it out again:

(difference-of-squares 25 16)


And then it puts 25 and 16 into the body of the procedure like this:

(-
(square 25) (square 16)
)


And again:

(-
(* 25 25) (* 16 16)
)


And again:

(- 625 256)


And finally returns the answer:

369.

This is called eager evaluation and most programming languages use it. But it isn't the only way of doing things. It could substitute like this instead:

(-
(square
(square 5)
) (square
(square 4)
)
)
. That's called lazy evaluation.




LynchingWith 9 votes in play, it takes 5 to lynch.

Loopdan
(4): teacher, Amzela, Clemency, Loopdan
Emperor flippyNips
(1): EGL

Not Voting
(4): Emperor flippyNips, Dell, dicideaq, ZombieStriker

Deadline:
(expired on 2019-01-06 08:45:00).


Mod notes:
ZombieStrikes and Dell have another (expired on 2018-12-29 08:45:00) to confirm before I start looking for a replacement.[/area]
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #111 (isolation #9) » Thu Dec 27, 2018 8:20 pm

Post by Plotinus »

Official Vote Count 1.03 (if)
Someone mentioned Python. I'm a python programmer too, but learning scheme is helping me become a better python progrmamer because I'm understanding concepts that I never really got before.

In programming you often want to test whether something is true, and if it is do one thing, if it's not, do something else. One way to do that in Scheme is with the procedure if.

So let's write a fibonacci program.

(define
(fibonacci n) (if
(<= n 1)
n
(+
(fibonacci
(- n 2)
) (fibonacci
(- n 1)
)
)
)
)


What this says is: Define fibonacci n to be a procedure such that if n is less than or equal to 1, return n, otherwise return the sum of the fibonacci of the difference between n and 2 and the fibonacci of the difference between n and 1.

So if I type in (fibonacci 4), this is what it's doing internally:
4 is not less than equal to 1, so
(+
(fibonacci 2) (fibonacci 3)
)

2 and 3 are not less than equal to 1 so
(+
(+
(fibonacci 0) (fibonacci 1)
) (+
(fibonacci 1) (fibonacci 2)
)
)

0 and 1 are less than equal to 1 so we're finally returning some values rather than more recursion:
(+
(+ 0 1 ) (+ 1
(+
(fibonacci 0) (fibonacci 1)
)
)
)

Almost there:
(+ 1
(+ 1
(+ 0 1)
)
)

And you can see that this is going to return 3.

Recursion is really easy in Scheme! It's harder in Python, which doesn't support tail call optimisation. This function doesn't use tail-recursion either because its tail call is to + not to fibonacci but you guys need a vote count.



LynchingWith 9 votes in play, it takes 5 to lynch.

Loopdan
(1): Clemency

Not Voting
(8): ZombieStriker, Dell, Loopdan, Emperor flippyNips, dicideaq, EGL, teacher, Amzela

Deadline:
(expired on 2019-01-06 08:45:00).


Mod notes:
ZombieStrikes and Dell have another (expired on 2018-12-29 08:45:00) to confirm before I start looking for a replacement.
In post 64, Loopdan wrote:
In post 60, teacher wrote:UNVOTE: please


I mean I like to live dangerously and all but I feel that was too much and proving a point???? I’m past useful today but we should make sure there is a tomorrow et al.
Does that count as an actual unvote?
In post 65, Loopdan wrote:
^@Plot
If it looks like a vote, it is. The automated vote counter doesn't care what is inside the unvote tag, but even if it did, I'd edit the post to help the vote counter understand it. For an example of something the automated vote counter doesn't understand:
Hypothetical player wrote:VOTE: unvote

For the automated vote counter: UNVOTE: --P
[/area]
Last edited by Plotinus on Thu Dec 27, 2018 11:25 pm, edited 1 time in total.
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #125 (isolation #10) » Fri Dec 28, 2018 6:05 am

Post by Plotinus »

Official Vote Count 1.04 (cond)
Sometimes you need to be able to go in more directions thans just left or right. That's where
(cond)
itionals come in. You can set up any number of conditions. You don't have to use
if
at all if you don't want to, because you could just as easily make a cond with two conditions. Factorial is only defined for integers >= 0 but wouldn't it be fun if we could have negative factorials too? What would that look like?

(define
(extended-factorial n) (cond
(
(= 0 n)
1) (
(= 1 n)
1) (
(= -1 n)
-1) (
(> n 1) (* n
(extended-factorial
(1- n)
)
)
) (else
(* n
(extended-factorial
(1+ n)
)
)
)
)
)


I could combine the first two conds with an or but I haven't introduced or to you guys yet, and this is readable enough.

So first it checks if n is 0. If it is, it returns 1 because wikipedia says that is how 0! is defined.
If n is not 0, it checks if n is 1. if it is, it returns 1.
If n is neither 0 nor 1 it checks if n is -1. If it is, it returns -1.
If n is greater than 1, it returns the product of n and extended-factorial of the decrement of n.
(1-)
is a procedure called decrement that takes an operand, x, and returns x - 1. It doesn't return "1 - x".
If all those things are false, then n is less than -1. So instead of
(else)
I could have written
(
(< n -1)
)
, so return the product of n and the extended-factorial of the increment of n.
(1+
is a procedure called increment that takes an operand, x, and returns 1 + x. I ran into increment before I ran into decrement and was briefly confused that (1+ x) didn't look like polish notation, but spacing is important here. 1+ is a procedure that happens to add one to something.

If you wanted to make life harder for your future self who has forgotten how your program works, you could write a procedure like this:
(define
(1+ x) (+ 2 x)
)


This terrible procedure wouldn't affect the way the + procedure works at all, it'd just overwrite the increment procedure. But it would still be terrible because the program does not do what its name leads you to think that it does! Anyway (+1 and (-1 are just a bit of syntactic sugar. You could just always write
(- x 1)
and
(+ x 1)



You might have noticed that in cond we acquire an extra set of parentheses that we don't acquire with if. This is because cond is more powerful than if. With if, you can only do one thing if it's true and only one thing if it's false, so it doesn't need an extra set of parentheses to group things. With cond, we can potentially have it do a whole sequence of things, and the extra parentheses show us when that whole sequence of things is done.




LynchingWith 9 votes in play, it takes 5 to lynch.

Loopdan
(2): Clemency, dicideaq
Clemency
(1): EGL
dicideaq
(1): teacher

Not Voting
(5): Dell, Loopdan, Amzela, ZombieStriker, Emperor flippyNips

Deadline:
(expired on 2019-01-06 08:45:00).


Mod notes:
ZombieStrikes and Dell have another (expired on 2018-12-29 08:45:00) to confirm before I start looking for a replacement.[/area]
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #131 (isolation #11) » Fri Dec 28, 2018 9:12 am

Post by Plotinus »

Dell1, Emperor flippyNips1, and ZombieStriker1 have not posted since the game began. They have been prodded and encouraged to start playing. Dell and ZombieStriker haven't opened their role PMs yet, so they will be replaced in (expired on 2018-12-29 08:45:00) if they don't join us. This is the same unchanged timer we've had in the votecounts.

Emperor flippyNips has (expired on 2018-12-30 18:00:00) to post before I start looking for a replacement, because the prod timer runs slower on the weekends.
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #156 (isolation #12) » Fri Dec 28, 2018 7:39 pm

Post by Plotinus »

Official Vote Count 1.05 Abstraction
So we have factorial which multiplies a bunch of numbers together, and the silly extended-factorial i wrote that multiplies a bunch of numbers together including negative ones, and I'm sure we could find a few more uses for multiplying a sequence of numbers together.

Rather than writing out the whole thing every time, let's be smart and lazy.

(define
(product func a next b) (if
(> a b)
1
(*
(func a) (product func
(next a)
next b)
)
)
)


Product is a procedure that takes 4 operands: a function to operate on like
square
or
*
or something, a starting value
a
, a function to produce the
next
a, and an endpoint,
b
.

If the starting point is bigger than the ending point, we're done, so return 1, because multiplying anything by 1 does nothing.

Otherwise, return the product of (evaluating the function on a) and (the result of calling product on the next a.

Well now we can do all kinds of things:
(define
(product-squares a b) (product square a 1+ b)
)


(product-squares 1 5) will now tell you that 12 * 22 * 32 * 42 * 52 is 14400.

We can do factorial again:
(define
(factorial-again a) (product * 1 1+ a)
)


We can approximate pi. Scheme is super fast. 100000 iterations of this is instantaneous on my ten year old computer.

(define
(approximate-pi n) (define
(wallis b) (/
(square
(* 2.0 b)
) (1-
(* 2 b)
) (1+
(* 2 b)
)
)
) (* 2
(product wallis 1 1+ n)
)
)


scheme@(guile-user)>
(approximate-pi 100000)

$61 = 3.141584799654507

In python, of course,
approxpi
(
100000
) causes "RecursionError: maximum recursion depth exceeded" but it takes 19 microseconds to do
approxpi
(
10)
, 188 microseconds to do
approxpi
(
100)
and 2.3 ms to do
approxpi
(
1000)
, so let's assume it continues in that fashion and that it would take 203 milliseconds to do what Scheme does instantaneously.

This isn't really a fair comparison because python doesn't have the recursion optimisations that Scheme has, but I rewrote it in an iterative form using a while loop and a counter and

%timeit
approxpi
(
100000
)
188 ms ± 774 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)

Spoiler: python
def
approxpi
(n):
def
square
(x):
return
x**
2
def
wallis
(b):
return
square
(
2
* b) / (
2
* b -
1
) / (
2
* b +
1
) answer =
1
while
n >
0
: answer *=
wallis
(n) n -=
1
return
2
* answer






LynchingWith 9 votes in play, it takes 5 to lynch.

dicideaq
(3): teacher, EGL, Loopdan
Loopdan
(2): Clemency, dicideaq

Not Voting
(4): Emperor flippyNips, Dell, Amzela, ZombieStriker

Deadline:
(expired on 2019-01-06 08:45:00).


Mod notes:
ZombieStrikes and Dell have another (expired on 2018-12-29 08:45:00) to confirm before I start looking for a replacement.[/area]
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #158 (isolation #13) » Fri Dec 28, 2018 8:48 pm

Post by Plotinus »

ZombieStriker and Dell are being replaced. If they, or their predecessors, join us before I find replacements, they can stay.
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #161 (isolation #14) » Sat Dec 29, 2018 12:37 am

Post by Plotinus »

Child replaces ZombieStriker! Please welcome them!
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #175 (isolation #15) » Sat Dec 29, 2018 5:58 am

Post by Plotinus »

u r a person 2 replaces Dell! Please welcome them!
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #177 (isolation #16) » Sat Dec 29, 2018 5:59 am

Post by Plotinus »

Official Vote Count 1.05 Abstracter Abstraction
Well we don't want always to find products. Sometimes we want to find sums. Also we did it recursively last time so let's do it iteratively this time. Recursion has two meanings in computer science and I don't want to confuse them. The first meaning is a procedure which calls itself. In that sense, all the procedures I've shown you have been recursive. For-each does exist in Scheme but it'll be many votecounts before I introduce it because we won't use it until we really need it and we don't need it yet.

The other meaning of recursion is a process that grows horizontally instead of just linearly. If you drew out all the evaluation steps it makes a kind of triangle, which the things it's holding in memory getting bigger and bigger. Imagine that Harry wants to add 4 and 7 so he gives the 4 to George and then George remembers 1 and hands a 3 to Fred, who remembers 1 and hands a 2 to Edith, who remembers 1 and hands a 1 to Dorothy, who remembers 1 and hands a 0 to Cathy, and then they pass the ones back up the line, adding them onto the 7 one at a time until you get 11.

So here is an accumulator that grows linearly. Because the only recursion is in a tail-call (the very last thing that iter-accumulate calls is itself), the compiler recognises that this is happening and doesn't keep the last iteration in memory, so the stack doesn't grow with each iteration, it doesn't take up more and more memory.

Accumulate takes a lot of arguments. Combiner will tell it whether we're doing products, sums, or something else. null-value is to help it get started: adding 0 or multiplying by 1 or something. If it doesn't need to do any iterations at all, this is what'll return. func is the same thing it was last time, a function that we're iterating over. When we were approximating pi it was (2n/(2n -1)) * (2n/(2n +1)). this-a is the current number that it's looking at. next-a is a function that tells it how to get to the next-a. last-a is our end point. In the internal function, answer is where we keep track of what we've figured out so far.

(define
(accumulate combiner null-value func this-a next-a last-a) (define
(iter-accumulate answer this-a last-a) (if
(> this-a last-a)
answer
(iter-accumulate
(combiner
(func this-a)
answer)
(next-a this-a) last-a)
)
) (iter-accumulate null-value this-a last-a)
)


Well now we can do products like this:

(define
(product func a next b) (accumulate * 1 func a next b)
)


And summations like this:

(define
(sum func a next b) (accumulate + 0 func a next b)
)


factorial now looks like:

(define
(factorial n) (product + 1 1+ n)
)


sum of squares is now just

(define
(sum-squares a b) (sum square a 1+ b)
)


And it's lightning fast. This is the biggest number that doesn't make a noticable delay on my ancient computer, and by unnoticable I mean < 100 miliseconds.

scheme@(guile-user)> (sum-squares 1 500000)
$30 = 41666791666750000

Spoiler: Python version of sumsquares is about 7 times slower, using a while loop to get from a to b.
def
accumulate
(
combiner, nullValue, func, thisa, nexta, lasta
): answer =
nullValue
while
thisa <= lasta: answer =
combiner
(
func
(thisa), answer) thisa =
nexta
(thisa)
return
answer
def
product
(
func, a, nexta, b
):
return
accumulate
(
lambda
x, y
: x * y,
1
, func, a, nexta, b)
def
sum
(
func, a, nexta, b
):
return
accumulate
(
lambda
x, y
: x + y,
0
, func, a, nexta, b)
def
sumOfSquares
(
a, b
):
return
sum
(
lambda
x
: x **
2
, a,
lambda
x:
1
+ x, b) %timeit
sumOfSquares
(
1
,
500000
)
719
ms ±
8.02
ms per loop (mean ± std. dev. of
7
runs,
1
loop each)





LynchingWith 9 votes in play, it takes 5 to lynch.

dicideaq
(2): teacher, EGL
Loopdan
(2): Clemency, dicideaq
Child
(1): Loopdan
Clemency
(1): Child

Not Voting
(3): Emperor flippyNips, u r a person 2, Amzela

Deadline:
(expired on 2019-01-06 08:45:00).


Mod notes:
Child is the new ZombieStriker! u r a person 2 is the new Dell![/area]
Last edited by Plotinus on Sat Dec 29, 2018 6:04 am, edited 1 time in total.
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #202 (isolation #17) » Sat Dec 29, 2018 9:36 am

Post by Plotinus »

Official Vote Count 1.06 Filtered Accumulator
Well the accumulator is nice but maybe we don't want all the sums of squares, maybe we just want the sum of the squares of prime numbers, or the product of the odd numbers.

omg this worked on my first try.

(define
(filtered-accumulate filter combiner null-value func this-a next-a last-a) (define
(iter answer this-a last-a) (cond
(
(> this-a last-a)
answer) (
(filter this-a) (iter
(combiner
(func this-a)
answer) (next-a this-a) last-a)
) (else
(iter answer
(next-a this-a)
last-a)
)
)
) (iter null-value this-a last-a)
)


In Scheme, procedures that produce a boolean often end in a ?. the built-in procedure "odd?" returns #t if a number is odd and #f if a number is even. Isn't that charming?

So now we can have:

(define
(sum-odd-nums a b) (filtered-accumulate odd? + 0 + a 1+ b)
)


Spoiler: And that just works straightforwardly
scheme@(guile-user)> (sum-odd-nums 1 10)
$35 = 25
scheme@(guile-user)> (+ 1 3 5 7 9)
$36 = 25


But let's make some more complicated filters. Let's make a prime test. (modulo) gives you the remainder when you divide a by b. If it's zero, they divide evenly:

(define
(prime? a) (define
(iter-guess guess) (cond
(
(< a 2)
#f) (
(>
(square guess)
a)
#t) (
(= 0
(modulo a guess)
)
#f) (else
(iter-guess
(1+ guess)
)
)
)
) (iter-guess 2)
)


Now we can just

(define
(sum-squares-primes a b) (filtered-accumulate prime? + 0 square a 1+ b)
)


Spoiler: hey it works
scheme@(guile-user)> (sum-squares-primes 1 30000)
$72 = 895753231576





LynchingWith 9 votes in play, it takes 5 to lynch.

dicideaq
(4): teacher, EGL, u r a person 2, Loopdan
Clemency
(1): Child
Loopdan
(1): dicideaq
Child
(1): Clemency

Not Voting
(2): Emperor flippyNips, Amzela

Deadline:
(expired on 2019-01-06 08:45:00).


Mod notes:
Keep it fun![/area]
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #265 (isolation #18) » Sat Dec 29, 2018 7:35 pm

Post by Plotinus »

Official Vote Count 1.07 Curry
Suppose we want the product of all positve integers less than n that are relatively prime to n. Relatively prime is just

(define
(relatively-prime? a n) (= 1
(gcd a n)
)
)


What's gcd? We can use stein's algorithm:

(define
(gcd a b) (define
(stein a b) (cond
(
(= a b)
a) (
(even? a) (stein
(/ a 2)
b)
) (
(even? b) (stein a
(/ b 2)
)
) (
(>= a b) (stein
(/
(- a b)
2)
b)
) (else
(stein
(/
(- b a)
2)
a)
)
)
) (if
(and
(even? a) (even? b)
)
2
(stein a b)
)
)


So far so good but remember that the filter in accumulate takes 1 argument and our relatively-prime? takes two. What should we do? Should we rewrite the function to make it even more complicated? Currying to the rescue! Currying is a way of making a function take 1 argument when it needs more than one, by providing one of the arguments for it with a helper function. In this case, curried-relatively-prime? inherits the value of n from the scope of its parent function, so it's straightforward to create a filter that our accumulator can understand.

Currying is one of those computer science concepts that I never understood the purpose of until basically right now when I started messing with scheme and suddenly found a use for it.

(define
(product-relatively-prime n) (define
(curried-relatively-prime? a) (relatively-prime? a n)
) (filtered-accumulate curried-relatively-prime? * 1 * 1 1+ n)
)


Spoiler: Hey look, it works!
scheme@(guile-user)> (product-relatively-prime 10)
$93 = 189
scheme@(guile-user)> (* 3 7 9)
$94 = 189


Currying is named after Haskell Curry. Haskell was also named after Curry!




LynchingWith 9 votes in play, it takes 5 to lynch.

Amzela
(3): EGL, Clemency, u r a person 2
dicideaq
(2): Loopdan, Amzela
Clemency
(1): Child
Loopdan
(1): dicideaq

Not Voting
(2): teacher, Emperor flippyNips

Deadline:
(expired on 2019-01-06 08:45:00).


Mod notes:
Keep it fun![/area]
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #288 (isolation #19) » Sun Dec 30, 2018 7:01 am

Post by Plotinus »

Official Vote Count 1.08 lambda
When I first ran across lambdas in python, a decade or so ago, I didn't get them. Why can't I just use
def
ine? Why do I need an anonymous function when I could just give my function a name and reuse it later? I found the syntax for them confusing. And then a few weeks ago I found myself wishing I could make a dictionary of one liner functions to be passed as arguments to bigger functions and remembered something about lambdas.

Suppose we want to make a function that approximates the integral of a function x from a to b for a given dx. We can use the
(sum)
function that we wrote before for this, because an integral is dividing a thing into a bunch of tiny pieces and then summing the tiny pieces. If you remember the sum function needs a way to get from one tiny piece to the next. We could write a little helper function like
(define
(integral-helper x) (+ x dx)
)
but then we have this little dinky function cluttering up our namespace. It's a lot simpler to just use an anonymous function here, with lambda. lambda is a primitive expression that generates a function.

We could do everything with lambdas if we wanted to, and (define (some-function)) is actually just syntactic sugar for lambda. You could write
(define add
(lambda
(x y) (+ x y)
)
)
instead of
(define
(add x y) (+ x y)
)
. Read it like "Define add to be the function of x and y that adds x to y".

Okay so now let's write our little integral function. We'll use the trapezoidal rule for taking integrals.

(define
(integral f a b dx) (*
(/ dx 2) (+
(f a) (* 2
(sum f a
(lambda
(x) (+ x dx)
) (- b dx)
)
) (f b)
)
)
)


dx if you remember means delta x, the change in x, or how big the little pieces we've divided this thing into. If we weren't approximating an integral, we'd be taking the limit as dx approaches zero, adding up pieces of almost-zero width. But in our approximation we can set dx to be 0.00001 or whatever.

In English: Define the integral of a function f from a to b dx to be the product of dx/2 and these three things: f(a), f(b), and 2 times the sum of f from a to b - dx. To get from number in the series to the next, we add dx to x.

scheme@(guile-user)>
(integral cube 0 1 0.00001)
$20 = 0.25000000002413625 scheme@(guile-user)>
(integral
(lambda
(x) (+
(* 5
(cube x)
) (* 3
(square x)
)
)
)
0 1 0.0001)
$25 = 2.250000017499499






LynchingWith 9 votes in play, it takes 5 to lynch.

Amzela
(3): EGL, u r a person 2, Child
dicideaq
(2): Loopdan, Amzela
Loopdan
(1): dicideaq

Not Voting
(3): Emperor flippyNips, teacher, Clemency

Deadline:
(expired on 2019-01-06 08:45:00).


Mod notes:
Keep it fun![/area]
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #304 (isolation #20) » Sun Dec 30, 2018 8:46 am

Post by Plotinus »

Official Vote Count 1.09 let
One thing lambdas let us do is define some variables in an extremely local scope. If I write
(lambda
(x) (* x x)
)
, that x only exists for the duration of that lambda and after that it's gone. If I write x somewhere else, it can mean something else. So if you want to write a little helper function inside a function to hold onto a few variables for just a little while, lambda is useful for that.

So useful, that they made an easier way of doing that, called let. The syntax for let is:

(let
(
(<var1> <exp1>) (<var2> <exp2>) (<var3> <exp3>)
) <body>
)


So what are all these parentheses? The outer ones, the red ones, define the boundaries of the let. The first red ( says that we're calling a procedure, named let, and the final red ) says that the procedure is over, all the variables defined therein are garbage and don't exist anymore. The orange ones show where the variables are going to be defined. The first orange ( says we're starting defining variables now, and the last orange one says we're done definine variables and now we're going to do some things with them. Finally, the inner ones, the yellow ones, are so that each variable gets their own space and we always know where one ends and the other begins.

Since a let is basically a lambda expression with some extra conveniences, you can also give them a name and then it works basically like a temporary named define that goes away when the let is over.

So suppose we want to approximate 1/φ with a truncated continued fraction. You know the kind that go:

Image

They continue on infinitely but we don't have infinite ram so we'll truncate it at some value k and get a partially correct answer. A number like 10 or 15 works pretty well here, you don't need to go that deep to approximate 1/φ.

(define
(cont-frac numerator denominator k) (let loop
(
(counter 0)
) (if
(> counter k)
numerator
(/ numerator
(+ denominator
(loop
(1+ counter)
)
)
)
)
)
)


In English: define a continued fraction with a numerator, a denominator, and some k, indicating the number of levels deep we're going to be:
let there be a loop with a counter that starts at 0. Loop doesn't mean anything to Scheme's compiler, it's just a name we're giving it to describe what it does.
The body of the loop starts here:
If the counter is greater than k, we're done, so put one final numerator in onto this thing.
Otherwise divide the numerator by the sum of the denominator and the result of jumping back to the start of the loop with an incremented counter

So round 1 we have (numerator / (denominator + i-don't-know-yet))
round 2 we have (numerator / (denominator + (numerator/(denominator + i don't know yet)))
round 3 we have (numerator / (denominator + (numerator/(denominator + (numerator/denominator + i don't know yet)))
...
round k we have (numerator / (denominator + (numerator/(denominator + (numerator/denominator + (...(numerator/(denominator+ numerator))))))))))

and then it's just some adding and dividing, which computers are good at and it spits out an answer for us. yay!

scheme@(guile-user)> (cont-frac 1.0 1.0 10)
$36 = 0.6180257510729613

If k is ten then 1/φ is accurate to 4 decimal places.





LynchingWith 9 votes in play, it takes 5 to lynch.

Amzela
(3): EGL, u r a person 2, Child
dicideaq
(2): Loopdan, Amzela
Loopdan
(1): dicideaq

Not Voting
(3): Emperor flippyNips, teacher, Clemency

Deadline:
(expired on 2019-01-06 08:45:00).


Mod notes:
Keep it fun![/area]
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #324 (isolation #21) » Sun Dec 30, 2018 7:58 pm

Post by Plotinus »

Dicideaq1 has been prodded. They have (expired on 2019-01-01 07:55:00) to post before I start looking for a replacement. This prod is about 4 hours late because I am just waking up. teacher has the algorithm right but I think he was counting in UTC instead of UTC+1. When we were on 48 hours prods I was able to do the weekends halftime math in my head but I just couldn't get used to the 36 hours shedule so I wrote a script for it.
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #325 (isolation #22) » Sun Dec 30, 2018 7:58 pm

Post by Plotinus »

Official Vote Count 1.10 quine
In computer science, a quine is a program that when you run it, it outputs its own sourcecode. In some languages they're difficult to construct. but in Scheme it is quite easy. The output of a file helloworld.scm containing only the text "Hello World" will output "Hello World" because a quoted string is self-evaluating. It both is, and contains, the string "Hello World".

We'll get back to recreational mathematics in the next vote count but I am preparing this before I go to bed in anticipation that it should be posted right when I wake up.




LynchingWith 9 votes in play, it takes 5 to lynch.

Amzela
(3): EGL, u r a person 2, Child
dicideaq
(2): Loopdan, Amzela
Loopdan
(1): dicideaq

Not Voting
(3): Emperor flippyNips, teacher, Clemency

Deadline:
(expired on 2019-01-06 08:45:00).


Mod notes:
Keep it fun![/area]
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #350 (isolation #23) » Mon Dec 31, 2018 9:09 am

Post by Plotinus »

Official Vote Count 1.11 procedures as first class objects
In Scheme, procedures are first class objects. This means that a function can return another function. A function can take a function as its arguments. A function can be stored in a list of functions. Functions can be named (with define) or anonymous (with lambda). Functions can be nested within each other, creating closures - binding variables within the scope of the function. We can use currying to reduce the arity of a function (make it require fewer arguments.)

A silly example that lets us do several of those things with funtions:

(define
(double procedure) (lambda
(x) (procedure
(procedure x)
)
)
)


So what does this do? Well it's a function that takes a procedure of some argument x and returns another function that applies the procedure twice to x.

(
(double 1+)
3)
results in 5. (add one to three twice). It is the same as typing
(1+
(1+ 3)
)


(
(double cube)
3)
results in 19683. Cube the cube of 3. It is the same as typing
(cube
(cube 3)
)
where cube is defined as
(define
(cube x) (* x x x)
)


These days it's not that exciting that a language supports first-class functions. C doesn't. Ruby doesn't allow nested functions but supports the other things. Fortran doesn't support anonymous functions. Java only partially supports first class functions. But Scheme's support for first class functions is probably part of why it has survived as a usable language in spite of being 43 years old. For example aisleriot, gnome's solitaire game that supports 88 varieties of solitaire, is written in Scheme and GIMP's extensions are written in Scheme. We've been looking at the basic building blocks, but there are libraries for running a web server or building gtk applications.



LynchingWith 9 votes in play, it takes 5 to lynch.

Amzela
(3): EGL, u r a person 2, Child
dicideaq
(2): Loopdan, Amzela
Loopdan
(1): dicideaq

Not Voting
(3): Emperor flippyNips, teacher, Clemency

Deadline:
(expired on 2019-01-06 08:45:00).


Mod notes:
Happy New Year![/area]
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #374 (isolation #24) » Mon Dec 31, 2018 7:50 pm

Post by Plotinus »

(1- players)
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #375 (isolation #25) » Mon Dec 31, 2018 7:50 pm

Post by Plotinus »

Official Vote Count 1.12 cons
Well we've been having fun with math but the only data structure we've seen so far has been an integer. And procedures I guess. But for most things we're going to need some way of
cons
tructing data types, a way of putting two things together.

The syntax for this is
(cons x y)
and what it does is create a pair that looks like
(x . y)
. Pairs are useful for all kinds of things. An imaginary number might be the cons of the real and imaginary parts. A pixel on your screen might be the cons of the x and y coordinates. We'll do some more with cons later.



LynchingWith 9 votes in play, it takes 5 to lynch.

dicideaq
(5): Loopdan, Amzela, u r a person 2, teacher, EGL
<-- LYNCH

Loopdan
(1): dicideaq
Amzela
(1): Child

Not Voting
(2): Emperor flippyNips, Clemency

Deadline:
(expired on 2019-01-06 08:45:00).


Mod notes:
A lynch![/area]
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #376 (isolation #26) » Mon Dec 31, 2018 7:59 pm

Post by Plotinus »

Day 1 Lynch - dicideaq


I have really been enjoying this lecture series from 1986. I have learned a lot from it and the lecturer is a very good speaker, very good at explaining the material in a clear way.


dicideaq has been lynched day 1. He was a
mafia goon.


It is now Night 1. Deadline for night actions is (expired on 2019-01-03 08:00:00)

As per , anyone who hasn't posted in the last 24 hours (Emperor flippyNips) must contact me at some point during the night phase so I know they are still playing. Otherwise they will be replaced and night will be extended.

We can do a shortened night phase if everybody wants that. I need to hear from everybody, though, whether or not you have a night action. If you want short night, reply to the night start PM I'm about to send out with a yes.
[/area]
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #377 (isolation #27) » Wed Jan 02, 2019 8:00 pm

Post by Plotinus »

Night 1 Kill - Loopdan


Part two of the first lecture!


Loopdan has been killed night 1. He was a
vanilla townie.


It is now Day 2
[/area]
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #378 (isolation #28) » Wed Jan 02, 2019 8:00 pm

Post by Plotinus »

Official Vote Count 2.00 car & cdr
So now that we know how to make a pair with (cons x y) it stands to reason that we should be able to extract the x or the y from the cons cell. (car (cons x y)) returns x and (cdr (cons x y)) returns y. The names are for historical reasons; on the very first lisp machine they stood for "contents of the add register" and "contents of the decrement register" but now they just mean "the head of the pair" and "the tail of the pair".



LynchingWith 7 votes in play, it takes 4 to lynch.

Everybody
(0): Nobody

Not Voting
(7): Amzela, Child, Clemency, EGL, Emperor flippyNips, teacher, u r a person 2

Deadline:
(expired on 2019-01-10 08:00:00).


Mod notes:
Keep it fun![/area]
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #400 (isolation #29) » Thu Jan 03, 2019 2:33 am

Post by Plotinus »

Official Vote Count 2.01 linked lists
It's really useful being able to group things together into pairs. It would be even more useful if we could somehow link more than 2 things together into a list. Does a language derived from a language called LISt Processer have such a thing?

The syntax for it is
(list x y z)
and the notation for explaining that list can take an arbitrary number of objects is actually
(list x . y)
which looks like a pair, but you'll see why y is standing in for an arbitrary number of things in a second.

(list)
is a bit of syntactic sugar. We could just write:

(cons a
(cons b
(cons c
(cons d e)
)
)
)
to generate a list (a b c d e).

Why are these two things the same? To answer this, we need to look at what list actually does.

+---+---+ +---+---+ +---+---+ +---+---+ +---+---+ | | -|-->| | -|-->| | -|-->| | --->| | / | +_|_+___+ +_|_+___+ +_|_+___+ +_|_+___+ +_|_+___+ | | | | | \ / \ / \ / \ / \ / . . . . . "Alice" "Bob" "Carol" "Daniel" "Edith"


This is a linked list. A linked list is a bunch of pairs. The car of each pair is a pointer that points to (the memory location of) some object, in this case a string, but it could be pointing to a procedure or a number or anything at all. The cdr of each pair is a pointer that points to the (memory location of the) car of the next item in a list. You don't have to know what the memory location is; that's figured out for you internally. The cdr of the item in the list links to the null list,
'()
, which is just an empty list whose value is null (or nil in lisp), and is a signal that the list is over.

Scheme, and lisps in general provide a lot of abbreviations for working with lists. We'll look at some of them today.

(car
("Alice" "Bob" "Carol" "Daniel" "Edith")
)

"Alice"
(cdr
("Alice" "Bob" "Carol" "Daniel" "Edith")
)

("Bob" "Carol" "Daniel" "Edith")
(cadr
("Alice" "Bob" "Carol" "Daniel" "Edith")
) ; the car of the cdr

"Bob"
(cddr
("Alice" "Bob" "Carol" "Daniel" "Edith")
) ; the cdr of the cdr

("Carol" "Daniel" "Edith")
(caddr
("Alice" "Bob" "Carol" "Daniel" "Edith")
) ; the car of the cdr of the cdr

"Carol"

And so on, four levels deep. If we had a multdimensional list like ((1 2) (3 4) (5)) then you might need to talk about the caar to get the car of the car or I think cadadr would get the 4 out of the list.

In practice you should be able to use simple recursion to only have to work with the car and the cdr.

If you want to work with linked lists then lisps are pretty good at that. If you really want an array then you might prefer to work in a language where your arrays don't have to be disguised linked lists. Things that are linked lists in real life: Trains, chains, strings of holiday lights, conga lines.

Things that are not linked lists in real life: cats, doorbells, pizza.




LynchingWith 7 votes in play, it takes 4 to lynch.

Child
(3): teacher, EGL, Clemency

Not Voting
(4): Emperor flippyNips, u r a person 2, Amzela, Child

Deadline:
(expired on 2019-01-10 08:00:00).


Mod notes:
Keep it fun![/area]
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #425 (isolation #30) » Thu Jan 03, 2019 7:48 pm

Post by Plotinus »

Official Vote Count 2.02 multipart numbers
We might want to use cons to represent rational numbers, like 3/4. That way instead of having to keep track of a separate numerator = 3 and denominator = 4 we could keep track of just one number, (3 . 4). But we should simplify improper fractions. If we a number like -19/95 then we want to store it as 1/5.

For this I'm going to write a helper function called xor. Xor means exclusive or. xor(x y) is true if only one of x or y is true. if both are true, xor(x y) is false. if both are false, xor(x y) is false.

(define
(xor preda predb) (cond
(
(and
(eq? #t preda) (eq? #t predb)
)
#f) (
(or
(eq? #t preda) (eq? #t predb)
)
#t) (else #f)
)
)
(define
(make-rational numerator denominator) (let
(
(g
(gcd
(abs numerator) (abs denominator)
)
)
) (cond
(
(xor
(< numerator 0) (< denominator 0)
) (cons
(/
(-
(abs numerator)
) g
) (/
(abs denominator)
g)
)
) (else
(cons
(/
(abs numerator)
g) (/
(abs denominator)
g)
)
)
)
)
)

Spoiler: it works!
scheme@(guile-user)> (make-rational 15 75)
$9 = (1 . 5)
scheme@(guile-user)> (make-rational 15 -75)
$10 = (-1 . 5)
scheme@(guile-user)> (make-rational -15 -75)
$11 = (1 . 5)
scheme@(guile-user)> (make-rational -15 75)
$12 = (-1 . 5)





LynchingWith 7 votes in play, it takes 4 to lynch.

Child
(2): EGL, Clemency

Not Voting
(5): u r a person 2, Amzela, Child, teacher, Emperor flippyNips

Deadline:
(expired on 2019-01-10 08:00:00).


Mod notes:
Keep it fun![/area]
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #450 (isolation #31) » Fri Jan 04, 2019 10:28 am

Post by Plotinus »

Official Vote Count 2.03 pointers
I want to go back a bit and talk some more about pointers. You saw in the box diagram in the last vote count that a linked list is basically a collection of cons cells, of pairs, and the car of each pair points to a piece of data, like the string "Alice" and the cdr of each pair points to the car of the next pair in the list. So what does it mean that these are pointers? How is it different from there just be a chain like [Alice]->[Bob]->[Carol]->[Daniel]->[Edith]? What's the point?

Let's make a list of primitive operators.

(define procedures
(list + - gcd * /)
)


I threw gcd in there too even though it's not a primitive operator because remember that there's no distinction between built-in functions and the ones that we make.

What do you think happens if I type

(
(car procedures)
3 4)
?

Well let's use the substitution rule to figure out what's happening. (car procedures) evaluates to +, right? So now it's just (+ 3 4). That's why we had two sets of parentheses at the start. One to evoke car, and one to evoke whatever car returns. So we get 7.

scheme@(guile-user)> ((cadr procedures) 3 4)
$2 = -1
scheme@(guile-user)> ((caddr procedures) 3 4)
$3 = 1
scheme@(guile-user)> ((cadddr procedures) 3 4)
$4 = 12
scheme@(guile-user)> ((cddddr procedures) 3 4)
ERROR: Wrong type to apply: (#<procedure / (#:optional _ _ . _)>)

Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]> ,q
scheme@(guile-user)> ((car (cddddr procedures)) 3 4)
$5 = 3/4

Okay so what's this error and why did it happen? Why didn't get cddddr get me the 5th element in the list the way caddr got me the 4th element? Remember, car gets the first item, and cdr gets the rest, cadr gets the second and the cddr gets the rest. Let's draw another box diagram.

+---+---+ +---+---+ +---+---+ +---+---+ +---+---+ | | -|-->| | -|-->| | -|-->| | -|-->| | / | +_|_+___+ +_|_+___+ +_|_+___+ +_|_+___+ +_|_+___+ | | | | | \ / \ / \ / \ / \ / . . . . . + - gcd * /


cddddr doesn't get us / it gets us the pair (cons / '()). This '() is a list terminator, the null list, and it's getting in the way of our decision. That's why we need the car of the cddddr.

But look at this magical thing we have here, we can call a named procedure, +, or whatever, without actually using the name of the function, because + is ~really~ just a pointer to the real procedure. and (car is also returning a pointer to the procedure, so ((car follows that pointer and evaluates that procedure. This is really exciting.




LynchingWith 7 votes in play, it takes 4 to lynch.

Child
(2): Clemency, u r a person 2

Not Voting
(5): EGL, Amzela, Child, teacher, Emperor flippyNips

Deadline:
(expired on 2019-01-10 08:00:00).


Mod notes:
Keep it fun![/area]
Last edited by Plotinus on Fri Jan 04, 2019 10:34 am, edited 3 times in total.
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #455 (isolation #32) » Fri Jan 04, 2019 10:35 am

Post by Plotinus »

Fixed, both issuse. Sorry! I forgot to paste the new votes in before.
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #481 (isolation #33) » Fri Jan 04, 2019 7:37 pm

Post by Plotinus »

Official Vote Count 2.04 pointers
Another thing about storing linked lists with pointers rather than storing the actual objects in the list is that the program can know in advance how much memory the list is going to take up, and so it knows the first address is at 0x1000 or somewhere and then maybe each pointer takes up 4 bytes, so it knows the next one is going to be at 0x1004. It doesn't have to walk through the list each time looking for the nth item, because it can just some quick math to find it. Which means if you'Re optimising your algorithm you can consider accessing an item in a list as taking a constant amount of time, because your CPU can execute that command in a single action.

Suppose lists weren't like that. What if we were storing our data in some xml tree where the items could be as big as they are and who knows how big the next row is? well then the only way to find something is to traverse the tree and it takes a lot longer and that's why xml is slow.

There's an entertaining article about this here. It's mostly about C though.




LynchingWith 7 votes in play, it takes 4 to lynch.

Child
(3): Clemency, u r a person 2, Emperor flippyNips

Not Voting
(4): Child, teacher, Amzela, EGL

Deadline:
(expired on 2019-01-10 08:00:00).


Mod notes:
Keep it fun!

Prods will go out in a minute.[/area]
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #482 (isolation #34) » Fri Jan 04, 2019 7:40 pm

Post by Plotinus »

Amzela1 and Child1 have been prodded. They have (expired on 2019-01-07 03:50:00) to post before I start looking for a replacement, because the timer runs slower on weekends.
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #491 (isolation #35) » Sat Jan 05, 2019 7:00 am

Post by Plotinus »

I'll interpret this as Amzela is V/LA until Sunday evening. In the future it is good to bold these things.
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #518 (isolation #36) » Sat Jan 05, 2019 12:09 pm

Post by Plotinus »

Official Vote Count 2.05 list operations part 1 && algorithmic complexity
There are a lot of built-ins for dealing with lists, but it is interesting to consider how one might implement them. For example there is the (last-pair ) which will tell you the last item in a list.

suppose we have a list of numbers, (1 2 3 4 5) and we don't know how long it is. All have is a pointer to the start of the list and then the list is as long as it is. Who knows where it is. How do we find the last item?

The only way is to walk through the list and check if each item is the last. How will we know when we get there? The cdr of the list will point to null rather than to a new item. This is just exactly the way strings work in c, except with lists. and they don't call them cdrs.

We don't know how long our list is, but we can use recursion to make the problem smaller and smaller until we have something we know how to solve. Suppose we had a list and we checked the cdr of it and we got null. That would mean we'd found our answer right away, that the list had only one element, that the first item was the last item. So we just return the last item and then we're done.

Suppose we have a list and we check the cdr of it and it is not null. That means we haven't found our answer yet, so let's do the same operation again on the cdr of the list, which is necessarily one element shorter than the first list. In this example we'd be looking at the list (2 3 4 5), then the list (3 4 5), then the list (4 5), then the list (5) and oh hey the cdr of that is null so that must be the answer!

(define
(my-last-pair lis) (if
(null?
(cdr lis)
)
lis
(my-last-pair
(cdr lis)
)
)
)


What is the algorithmic complexity of this algorithm? If n is an arbitrarily large number, like 1000000, how much longer will it take than if n is 10? How much memory will it take up while it's doing its computations?

Each pass, it does these operations:
1) follow a pointer to the cdr of the list
2) check whether the cdr is null
3) return an answer or call itself with a smaller list

We can assume that each of these basic operations takes a constant amount of time, perhaps 1 nanoseconds each. So it's time complexity is going to grow linearly. If n is one then it does 3 things in 3 nanoseconds. If n is ten then it does 30 things in 30 nanoseconds . If n is a million then it does 3 million things in 3 miliseconds . Linear growth, growth by a factor of n, is written as O(n), and it is pretty good. The only thing better would be constant time, if we just knew the answer without having to look it up and then it would take 1 nanosecond to find it no matter where it was or how deep in the list. I can't think of a way to do that -- we could store the answer in a lookup table but then how do we know where it is in the lookup table without looking for it? What even is a lookup table if it's not a list?

Finding the nth item in the list is something we can do in constant time. The command for this is (list-ref index some-list) but you need to know the index for it to work. If we want the last item in the list then we have to find out how long the list is and we can only do that by walking down the list. So I think linear time is as good as it gets in practice.

What about memory? Well, remember that Scheme has tail-call optimisation, which means that if the very last thing a function does is call another function, then it doesn't have to keep the function available in the stack (in memory) because it's done; instead whatever the next function returns is going to be sent to the parent function: whatever isn't done.

So we call (my-last-pair '(1 2 3 4 5)), and it calls (my-last-pair '(2 3 4 5)) but it doesn't stick around for the answer; it doesn't care anymore. So we still have only two process running in memory: whoever started this off to begin with, and the one that is currently running. Now the new one calls (my-last pair '(3 4 5)) but it doesn't stick around the for the answer. It doesn't care anymore. It's gone. Now the new one calls (my-last pair ('4 5)) but it doesn't care about the answer either. It's gone. So finally we're calling (my-last-pair '(5)) but the process that calls it doesn't care about the answer either so that's gone too. And now we return 5. Who do we return it to? none of the processes in the middle are here anymore. We return it to whoever made that very first call, the one to (my-last-pair '(1 2 3 4 5)). Maybe it was just the user who typed it into the interactive prompt, in that case we return it to them by printing it on the screen. Maybe it was some function like (define last-one (my-last pair '(1 2 3 4 5))), so we return it to that define function, which now knows what value to assign to last-one: '(5).

So the amount of memory this function takes up is constant. Even if the list is a million items long, it never has more 2 items on the stack. The memory complexity is O(2). This means that even my antique computer will not be overwhelmed by it!




LynchingWith 7 votes in play, it takes 4 to lynch.

Child
(4): Clemency, u r a person 2, Emperor flippyNips, teacher
<-- LYNCH


Not Voting
(3): Child, Amzela, EGL

Deadline:
(expired on 2019-01-10 08:00:00).


Mod notes:
A lynch![/area]
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #519 (isolation #37) » Sat Jan 05, 2019 12:11 pm

Post by Plotinus »

Day 2 Lynch - Child


Part 2a!


Child has been lynched day 2. He was a
vanilla townie.


It is now Night 2. Deadline for night actions is (expired on 2019-01-08 08:00:00). Everyone has posted in the last 24 hours so nobody is in danger of being replaced.

We can do a shortened night phase if everybody wants that. I need to hear from everybody, though, whether or not you have a night action. If you want short night, reply to the night start PM I'm about to send out with a yes.
[/area]
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #520 (isolation #38) » Mon Jan 07, 2019 8:01 pm

Post by Plotinus »

Night 2 Kill - Nobody


Part 2b! This one is really interesting. Also I was really confused for a while about how this guy kept getting more hair and then less hair before I eventually figured out there were two guys.


Nobody has been killed night 2. It is now Day 3!
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #521 (isolation #39) » Mon Jan 07, 2019 8:01 pm

Post by Plotinus »

Official Vote Count 3.00 map
It is really common to want to do the same thing to every item in a list. The way to do this is with (map). For example (map square '(1 2 3 4)) would use our square function from earlier to produce a new list (1 4 9 16).




LynchingWith 6 votes in play, it takes 4 to lynch.

Everybody
(0): Nobody

Not Voting
(6): Amzela, Clemency, EGL, Emperor flippyNips, teacher, u r a person 2

Deadline:
(expired on 2019-01-15 08:00:00).


Mod notes:
Keep it fun![/area]
Last edited by Plotinus on Mon Jan 07, 2019 8:19 pm, edited 1 time in total.
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #527 (isolation #40) » Mon Jan 07, 2019 8:12 pm

Post by Plotinus »

Official Vote Count 3.01 foreach
foreach is like map. It's for when you want to do something with each item in a list. Print them, for example. Map is if you want to change everything in a list in the same way, foreach is if you want to use each item to do something else.

(for-each
(lambda
(x) (newline) (display x)
) (list 1 2 3)
)


This will print:
1
2
3




LynchingWith 6 votes in play, it takes 4 to lynch.

Everybody
(0): Nobody

Not Voting
(6): Amzela, Clemency, EGL, Emperor flippyNips, teacher, u r a person 2

Deadline:
(expired on 2019-01-15 08:00:00).


Mod notes:
Keep it fun![/area]
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #569 (isolation #41) » Tue Jan 08, 2019 7:37 am

Post by Plotinus »

Official Vote Count 3.02 trees
So far we've mostly been thinking about lists in a flat way but you can build intricate structures out of linked lists, and one common structure is called a tree. On most computers, the entire file system is organised in a tree like structure. On Linux we have the root node, / which contains some branches like usr, home, bin, dev, and then each of those are nodes which contain some more branches. On Windows you have a root node like C:\ and inside it you have some branches like My Documents, My Pictures, etc. and Macs are basically the same as Linux these days.

Or in your browser, if you have a lot of bookmarks, you might start organising them a little by category so that you don't have more than a screenful in one folder. You might have a games folder or a sports folder or a news folder or a recreational mathematics folder.

So you're familiar with the idea of having folders which can contain folders which can contain folders.

The most basic kind of tree is a binary tree. Each node can contain, at most, two things, but they can have an arbitrary amount of children. You could also have ternary trees where each node has at most 3 children, and quarternary trees with 4 children. All of these words have the suffix -ary so we can talk about the arity of a tree: how many children each node can have. There was a hilarious lecture by Donald Knuth about three-halvsary trees in which each node could have 3/2 children, and he proposed that if we were to study trees that had i children we could call them imagin-ary trees.

Anyway, let's do binary trees because they're easy and important.

Image

(15
(10
(8 12)
20
(16 25)
)
)


How do we make this? Well we just:

(list 15 (list 10 (list 8 12) 20 (list 16 25)))




LynchingWith 6 votes in play, it takes 4 to lynch.

Emperor flippyNips
(4): Clemency, u r a person 2, teacher, Amzela
<-- LYNCH


Not Voting
(2): Emperor flippyNips, EGL

Deadline:
(expired on 2019-01-15 08:00:00).


Mod notes:
A lynch![/area]
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #570 (isolation #42) » Tue Jan 08, 2019 7:44 am

Post by Plotinus »

Day 3 Lynch - Emperor flippyNips


This one's about how to make escher like pictures in Scheme!


emperor flippyNips has been lynched day 3. He was a
mafia rolecop
!

This means town has won Newbie 1909 | Scheme. I hope you enjoyed it! Scheme's source code is, itself, basically a linked list, which makes it particularly good for AI programming. If you're ever writing a program that needs to edit its own source code, think of Scheme. It's evolved some since 1986. You can import object oriented programming now, for example.

So congratulations to
Clemency, town neapolitan, Amzela, town doctor,
Child, EGL, Loopdan, teacher, and u r a person 2, vanilla townies.


I think everybody played well.
[/area]
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #571 (isolation #43) » Tue Jan 08, 2019 7:49 am

Post by Plotinus »

Game Events


day 1
  • dicideaq
    is lynched with 0 scum on his wagon.


night 1
  • Clemency
    is checking
    teacher
    (success: teacher is a
    vanilla townie
    ).
  • Amzela
    is protecting
    teacher
    (success: teacher lives).
  • Emperor flippyNips
    is killing
    Loopdan
    (success: Loopdan dies).
  • Emperor flippyNips
    is rolecopping
    teacher
    . (success: teacher is
    vanilla
    )


day 2
  • Child
    is lynched with 1 scum on his wagon.


night 2
  • Clemency
    is checking
    emperor flippyNips
    . (success: emperor flippyNips is not a vanilla townie)
  • Amzela
    is protecting
    teacher
    . (success: teacher lives)
  • Emperor flippyNips
    is killing
    teacher
    . (failure: teacher is protected)
  • Emperor flippyNips
    is rolecopping
    EGL
    . (success: EGL is
    vanilla
    )


day 3
  • Emperor flippyNips
    is lynched with 0 scum on his wagon.


Links


Links
Last edited by Plotinus on Tue Jan 08, 2019 8:24 am, edited 1 time in total.
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #572 (isolation #44) » Tue Jan 08, 2019 7:50 am

Post by Plotinus »

This thread is now open for post-game commentary. You can post here even if you were dead and even if you didn't play.
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #600 (isolation #45) » Tue Jan 08, 2019 7:53 pm

Post by Plotinus »

The last post in teacher's thread came when Amzela was resisting claiming her role. It's worth pointing out that both scum and the hidden PR reacted the same way to this situation. I think it's a pretty natural reaction from the perspective of a PR, especially a newer player.

I think Clemency's post asking for a claim looked pretty clearly like "I have a result and I need everybody to claim so I can catch them in a lie" but of course it would be clear to me when I have the answers already. But it's something to pay attention to in future games, both as town and as scum -- think about all the possible night actions that could have affected you and see if you still have a path to win. In this case I don't think there was because scum needed two mislynches and even if you lynch the cop/tracker/jailkeeper/neapolitan today you still get lynched tomorrow. But sometimes there will be.
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4
User avatar
Plotinus
Plotinus
Kitten Caboodle
User avatar
User avatar
Plotinus
Kitten Caboodle
Kitten Caboodle
Posts: 7611
Joined: March 13, 2015
Location: UTC+1

Post Post #608 (isolation #46) » Wed Jan 09, 2019 8:04 pm

Post by Plotinus »

Thanks for reminding me. I forgot: viewtopic.php?f=90&t=78181
The failure mode of clever is asshole.

Modding checklists | Sequencer is in Game 5 | Space II is in Day 4

Return to “The Road to Rome [Newbie Games]”