Handle min, max and step to produce a regular expression for ranges of decimal numbers.
LL : update README.html with pandoc -f markdown README.md > README.html.
LL : recorrection positive_at_most_regexp() and missing some_contiguous_spaces_intra_number.
LL : correction bis negative_at_least_regexp() and positive_at_most_regexp() for cases like min -12.1234 must validate -12.12 or -12.10000 for example but this time with not_a_digit_regexp and correct handling of spacing at the end.
LL : recorrection negative_at_least_regexp() and positive_at_most_regexp() for cases like min -12.1234 must validate -12.12 or -12.10000 for example.
LL : re?correction error messages for 4 explode_and_check_unicity() calls.
LL : add regexp_enclosing_start parameter + dev function enclose_regexp() with memoization (when needed).
LL : add ':' to all labels, always add '\n' before and after "" for nicer html source code.
Hello,
I tried this code:
fn main() {
let array = [10, 20, 30];
print!("Iterating over array:");
for n in array {
print!(" {n}");
}
println!();
print!("Iterating over range:");
for i in 0..4 {
print!(" {}", array[i]);
}
println!();
}
which is a one digit modification of the exercise there : https://google.github.io/comprehensive-rust/exercises/day-1/for-loops.html
I expected to see this happen: a nice compiler error at time of build
Instead, this happened:
a nice crash report at execution
Compiling playground v0.0.1 (/playground)
Finished dev [unoptimized + debuginfo] target(s) in 1.17s
Running target/debug/playground
thread 'main' panicked at 'index out of bounds: the len is 3 but the index is 3', src/main.rs:11:23
note: run with RUST_BACKTRACE=1
environment variable to display a backtrace
Iterating over array: 10 20 30
Iterating over range: 10 20 30
Since there is no conditional at all between creation of array and loop definition, I thought Rust would catch it. (Well, technically there may be conditionals in print macros.) I did it first on the website but I reproduced directly on my machine, and here are the outputs from my machine.
rustc --version --verbose
:
rustc 1.61.0
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.61.0
LLVM version: 14.0.6
RUST_BACKTRACE=1 cargo run
Finished dev [unoptimized + debuginfo] target(s) in 0.02s
Running `target/debug/exercise`
Iterating over array: 10 20 30
thread 'main' panicked at 'index out of bounds: the len is 3 but the index is 3', src/main.rs:11:23
stack backtrace:
0: rust_begin_unwind
at /build/rustc-zmPChZ/rustc-1.61.0+dfsg1/library/std/src/panicking.rs:584:5
1: core::panicking::panic_fmt
at /build/rustc-zmPChZ/rustc-1.61.0+dfsg1/library/core/src/panicking.rs:143:14
2: core::panicking::panic_bounds_check
at /build/rustc-zmPChZ/rustc-1.61.0+dfsg1/library/core/src/panicking.rs:84:5
3: exercise::main
at ./src/main.rs:11:23
4: core::ops::function::FnOnce::call_once
at /build/rustc-zmPChZ/rustc-1.61.0+dfsg1/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Iterating over range: 10 20 30
@pyzenberg Maybe this is more readable :
INSTALLED_APPS = [
# ----------------------------------------------------------
# should be first to prevent thread lock issues
"drf_yasg",
# ----------------------------------------------------------
# django apps
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"django.contrib.humanize",
"django.contrib.gis",
"django.contrib.postgres",
# ----------------------------------------------------------
# drf apps
"corsheaders",
"rest_framework",
"rest_framework.authtoken",
"django_filters",
# ----------------------------------------------------------
# wagtail apps
"wagtail.contrib.forms",
"wagtail.contrib.redirects",
"wagtail.contrib.settings",
"wagtail.contrib.modeladmin",
"wagtail.contrib.routable_page",
"wagtail.embeds",
"wagtail.sites",
"wagtail.users",
"wagtail.snippets",
"wagtail.documents",
"wagtail.images",
"wagtail.search",
"wagtail.admin",
"wagtail.core",
# ----------------------------------------------------------
# 3rd-party apps
"versatileimagefield",
"mptt",
"ckeditor",
"ckeditor_uploader",
"jalali_date",
"qr_code",
"logentry_admin",
"rest_framework_tracking",
"modelcluster",
"taggit",
"crispy_forms",
"django_extensions",
"constance.backends.database",
"constance",
"fcm_django",
"import_export",
"adminsortable",
# ----------------------------------------------------------
# project apps
"market_auth",
"market_structure",
"market_gis",
"market_catalog",
"market_order",
"market_callcenter",
"market_dashboard",
"market_mag",
"market_hr",
"market_util",
]
I just added this line
# ----------------------------------------------------------
in your empty lines,
since you already had comments to tell what is about each of your blocks of code.
I agree that your example is readable but it has both comments and empty lines. And the good point to tell others why you structure your code this way is with comments. I do not think that my example is less readable, but you may not like it. You can try other ways to "explicit empty lines" Black must do some choices and I sincerely think that our suggestions are the best choice given all the problems needed to solve.
Just found the way to relaunch the check :)
I just signed the CLA but cannot seem to relaunch the check for the CLA.
missing verb : "The goal of the course to teach you Rust." -> "The goal of the course is to teach you Rust."
missing of ? : "to cover all it" -> "to cover all of it" for this one, I'm not a native english speaker but it seems more correct to me. I'll let you check :)
Corrected 1 or 2 typos
missing verb : "The goal of the course to teach you Rust." -> "The goal of the course is to teach you Rust."
missing of ? : "to cover all it" -> "to cover all of it" for this one, I'm not a native english speaker but it seems more correct to me. I'll let you check :)
LL : correction when step 0.04 : state_to_reduced_transitions.set(0 -> state, ...).
LL : add README.html generated with pandoc -f markdown README.md > README.html.
LL : correct algorithm for handling all steps with infinite time and space available, currently 5 or 0.5 works although moderately efficient, but 25 or 0.25 exhausts memory; recorrection allow zero number when a step is given.
LL : add support for all integer steps (if the total_length of all intermediate subregexps does not exceed one million), update message below step and README.md.
LL : app.html UX enhanced with onkeyup="result_changed()" for result text_area to update regexp on test_string and call reinit_test_your_result() + result focus() after.
LL : end of spacing :) with 2 parameters added: (min|max)_number_of_contiguous_digits (HTML + JS + updated README).
LL : 12 more parameters for spacing intra number with a lot on impacts on many subregexps, factorization with check_collision_for_space_characters() and get_regexp_with_minmax_repeat_and_spacing(), set min = 0 when min = null and generate "?", "*", "+" in get_repeat_string().
LL : add 3 parameters ((min|max)number_of|)spaces_after_last_digit (HTML + JS + README), every "$" reviewed.
LL : add 3 parameters ((min|max)number_of|)spaces_between_sign_and_number (HTML + JS + README), every ...sign_regexp reviewed, add return "" in get_repeat_string() if min === max === 1.
LL : correction README.md with empty line before unordered list, add Spacing paragraph, and ") {" -> "){" in app.html.
Thank you very much Albert @tarleb :)
LL : handling 6 more parameters: ((min|max)number_of|)spaces_before_(sign|number) with get_repeat_string() returning "*" or "+" if possible and get_regexp_with_repeat() returning "" if regexp is "".
Explain the problem. Hello,
I tried to convert the markdown here https://raw.githubusercontent.com/LLyaudet/DecimalsRangeRegexpGenerator/main/README.md to HTML with : pandoc -f markdown README.md > README.html
But I don't obtain <ul><li>blabla</li><ul>
in the HTML for the blocks with :
- blabla
in the markdown
Github does extract unordered lists correctly: https://github.com/LLyaudet/DecimalsRangeRegexpGenerator/blob/main/README.md But I verified that I only use basic features of markdown in my file; no GitHub extension, thus pandoc should handle it.
I tried changing:
- blabla
with
* blabla
but it did not work either.
Pandoc version? I am using Pandoc version:
$ pandoc --version
pandoc 2.17.1.1
Compiled with pandoc-types 1.22.2, texmath 0.12.4, skylighting 0.12.3.1,
citeproc 0.6.0.1, ipynb 0.2
User data directory: /home/laurent/.local/share/pandoc
Copyright (C) 2006-2022 John MacFarlane. Web: https://pandoc.org
This is free software; see the source for copying conditions. There is no
warranty, not even for merchantability or fitness for a particular purpose
on latest Ubuntu 22.10. I also reproduced the bug here: https://pandoc.org/try/
Thanks, best regards, Laurent Lyaudet
LL : add <> around urls and link to my website in README.md, better regexp \d* -> 0|[1-9]\d* for min and max inputs.
LL : add pedagogic "Allow leading/trailing decimal separator (without any digit before)" disabled checkboxes with explanations; add all features in README.md and TODO.