Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions exercises/practice/complex-numbers/.docs/instructions.append.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
# Instructions append

The Phix compiler is normally aware of all the standard packages that are distributed with it, and automatically
incorporates them for you when needed, however that is not always the case, just as it would not be for components
you have created as part of an application. This (dirt-simple) exercise involves nothing more than locating the
standard complex number package that is distributed with Phix and making it available for the tests to run.
## Track specific instructions

You may use the [online][[online] copy of the docs, though if you have installed a copy locally you may find it has
better search facilities, especially the chm version, typically located in C:\Program Files[ (x86)]\Phix\docs\phix\.
The Phix compiler is normally aware of all the standard packages that are distributed with it, and automatically incorporates them for you when needed, however that is not always the case, just as it would not be for components you have created as part of an application.
This (dirt-simple) exercise involves nothing more than locating the standard complex number package that is distributed with Phix and making it available for the tests to run.

Should you want to learn how complex number arithmetic is implemented, you can do no better than to examine the
source code of that standard component, at least generally speaking - I am not going to deny there may be slightly
better algorithms out there for one or two things, that could be faster or more precise or both.
You may use the [online][[online] copy of the docs, though if you have installed a copy locally you may find it has better search facilities, especially the chm version, typically located in `C:\Program Files[ (x86)]\Phix\docs\phix\`.

Should you want to learn how complex number arithmetic is implemented, you can do no better than to examine the source code of that standard component, at least generally speaking - I am not going to deny there may be slightly better algorithms out there for one or two things, that could be faster or more precise or both.

[online]:(http://phix.x10.mx/docs/html/phix.htm)
2 changes: 2 additions & 0 deletions exercises/practice/flatten-array/.docs/instructions.append.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Instructions append

## Track specific instructions

In Phix null==0 but/hence for these tests we have to use -1 instead.
4 changes: 2 additions & 2 deletions exercises/practice/ledger/.docs/instructions.append.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Instructions append

Note the test harness for this exercise invokes printf(0,"",{"unicode_align",true}) which is needed to properly align
multibyte unicode/UTF-8 characters, specifically here the Euro sign, and hence get the tests to pass.
## Track specific instructions

Note the test harness for this exercise invokes `printf(0,"",{"unicode_align",true})` which is needed to properly align multibyte unicode/UTF-8 characters, specifically here the Euro sign, and hence get the tests to pass.
13 changes: 5 additions & 8 deletions exercises/practice/linked-list/.docs/instructions.append.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
# Instructions append

Phix does not have pointers, and implementing something like a linked list which is slightly tricky
to begin with, perhaps by emulating pointers with indexes, would not only be even trickier but also
utterly pointless, given that a standard sequence, the very backbone of the language, deals with
such things in a much easier and almost trivial way. Hence this exercise is a very simple one, to
emulate the behaviour of a double-linked(/ended) list using a single (flat) sequence, without any
pointers or similar of any kind. While multiple lists could be handled using multiple returns, or
the provided stack/queue include could be used (both can be instructed to perform an operation on
their "other" end), to further simplify matters we'll just use the single static variable "list".
## Track specific instructions

Phix does not have pointers, and implementing something like a linked list which is slightly tricky to begin with, perhaps by emulating pointers with indexes, would not only be even trickier but also utterly pointless, given that a standard sequence, the very backbone of the language, deals with such things in a much easier and almost trivial way.
Hence this exercise is a very simple one, to emulate the behaviour of a double-linked(/ended) list using a single (flat) sequence, without any pointers or similar of any kind.
While multiple lists could be handled using multiple returns, or the provided stack/queue include could be used (both can be instructed to perform an operation on their "other" end), to further simplify matters we'll just use the single static variable "list".

[//]:# (this should require simple-linked-list to be completed first...)
4 changes: 2 additions & 2 deletions exercises/practice/phone-number/.docs/instructions.append.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Instructions append

You may return "error" instead of any of the more specific error messages that contain "not" or "must",
which in the tests specified for this exercise is all of them, or be prepared to return 13 different errors.
## Track specific instructions

You may return "error" instead of any of the more specific error messages that contain "not" or "must", which in the tests specified for this exercise is all of them, or be prepared to return 13 different errors.
20 changes: 10 additions & 10 deletions exercises/practice/pov/.docs/instructions.append.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Instructions append

I consider this one of the most difficult exercises on this site: although the final code itself is
likely to be fairly straightforward, it may well be a challenge to conceptualise what it should do.
It can certainly trigger every possible p2js violation known to mankind, so I'd certainly recommend
solving it first under "without js", and later fixing it under "with js" only if you must. In fact,
the testing harness for this exercise already applies "without js" for you (and there is no way you
could possibly disable that when running online).

For simplicity every tree/node must obey enum LABEL, CHILDREN, eg {"parent",{{"a",{}}}}, where each
element of CHILDREN also obeys the same rule. The {} is not optional. Not that I can think why, but
you would be allowed extra elements after those two. Every tree in/from the test data obeys said.
## Track specific instructions

I consider this one of the most difficult exercises on this site: although the final code itself is likely to be fairly straightforward, it may well be a challenge to conceptualise what it should do.
It can certainly trigger every possible p2js violation known to mankind, so I'd certainly recommend solving it first under "without js", and later fixing it under "with js" only if you must.
In fact, the testing harness for this exercise already applies "without js" for you (and there is no way you could possibly disable that when running online).

For simplicity every tree/node must obey enum LABEL, CHILDREN, eg `{"parent",{{"a",{}}}}`, where each element of CHILDREN also obeys the same rule.
The `{}` is not optional.
Not that I can think why, but you would be allowed extra elements after those two.
Every tree in/from the test data obeys said.

5 changes: 3 additions & 2 deletions exercises/practice/prime-factors/.docs/instructions.append.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Instructions append

## Track specific instructions

There is a builtin that almost does this for you, and no shame in using that.
(No shame of course in using full longhand/longwinded code to solve this either.)
Tip: the builtin returns {1} rather than the {} this exercise demands, and you'd
have to override both default parameters to get it to return the right thing.
Tip: the builtin returns `{1}` rather than the `{}` this exercise demands, and you'd have to override both default parameters to get it to return the right thing.
10 changes: 5 additions & 5 deletions exercises/practice/robot-name/.docs/instructions.append.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Stress test
# Instructions append

## Stress test

Test 8 seeks to prove unique names are generated for all 676,000 robots, but gives up after 5s.
Only if it completes will there be a ninth test (no more robot names). Should you only pass 8
tests (and the 8th will have "[incomplete]" in it's description), it will still congratulate
you and let you submit your work, but perhaps you should consider a more efficient approach.
Only if it completes will there be a ninth test (no more robot names).
Should you only pass 8 tests (and the 8th will have "[incomplete]" in it's description), it will still congratulate you and let you submit your work, but perhaps you should consider a more efficient approach.
The example/test solution manages to fully complete all tests in 0.5s, just so you know.

6 changes: 2 additions & 4 deletions exercises/practice/simple-cipher/.docs/instructions.append.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Instructions append

Traditionally, encrypted results have spaces and punctuation removed and are converted to upper/lower case,
however when a test specifies a bPreserve of true neither of those should occur, and when false the result
should only contain the lowercase letters a..z, in which case perfect decryption isn't actually possible,
but rest assured the testing code is smart enough to know that.
## Track specific instructions

Traditionally, encrypted results have spaces and punctuation removed and are converted to upper/lower case, however when a test specifies a bPreserve of true neither of those should occur, and when false the result should only contain the lowercase letters `a..z`, in which case perfect decryption isn't actually possible, but rest assured the testing code is smart enough to know that.
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
# Instructions append

Phix does not really have pointers, because it doesn't need them. The sequence type should always
be your first thought when thinking about storing data (graduating to in-memory dictionaries, and
on-disk databases as required), and in fact they are quite likely to outclass more traditionally
taught linked lists in maybe 99% of all cases. They can shrink and grow at will, with no manual
housekeeping, which not only instantly eliminates the main reason anybody ever still uses linked
lists but can even eradicate the housekeeping that linked lists themselves normally need.
## Track specific instructions

This trivial exercise has two aims: to introduce sequences and some simple operations on them,
and to extinguish any desire for fiddly pointer-based structures that just don't belong in Phix.
Phix does not really have pointers, because it doesn't need them.
The sequence type should always be your first thought when thinking about storing data (graduating to in-memory dictionaries, and on-disk databases as required), and in fact they are quite likely to outclass more traditionally taught linked lists in maybe 99% of all cases.
They can shrink and grow at will, with no manual housekeeping, which not only instantly eliminates the main reason anybody ever still uses linked lists but can even eradicate the housekeeping that linked lists themselves normally need.

This trivial exercise has two aims: to introduce sequences and some simple operations on them, and to extinguish any desire for fiddly pointer-based structures that just don't belong in Phix.

[//]:# (now I've said all that, freelists really are a separate concept...)
[//]:# (this, and linked-list might want to be concepts not exercises...)

2 changes: 2 additions & 0 deletions exercises/practice/two-fer/.docs/instructions.append.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Instructions append

## Track specific instructions

Phix provides support for [optional parameters](http://phix.x10.mx/docs/html/procedures.htm#optionalparams).