Comments (2)
from nimprogrammingbook.
Thanks for reporting. I think you are referring to the example
import regex
from std/strutils import repeat
const
FileName = "csvdata.txt"
P = """([^,]+)"""
r = re(repeat(P & ',', 5) & P)
proc main =
var m: RegexMatch
for l in Filename.lines:
if l[0] != '#': # skip first two and all other comment lines
if match(l, r, m):
when true: # debug
discard
else:
for i in 0 .. 5:
stdout.write(m.group(i, l))
stdout.write(' ')
echo ""
else:
assert false
main()
Yes, the statement "when true: discard" was intended to avoid all the output, because we try to compare the performance of various parsing strategies. With actual output, that would be dominated by the relatively slow output operation. Maybe I should better have defined a const named Debug, and used that const to suppress output. I think some of the other examples do that. I may adapt this example next time when I apply again some tiny grammar fixes. I think GPT-4 may find some more.
And congratulations that you have managed to read the book so far. Have you been able to follow the explanations and understand them?
Best regards,
Stefan Salewski
from nimprogrammingbook.
Related Issues (17)
- Typo HOT 1
- License? HOT 13
- maybe an effecient way to broadcast message in the chat server application HOT 4
- executable examples HOT 5
- Permission to translate the book HOT 3
- Some thoughts about async HOT 3
- Broken URL HOT 2
- Wrong word HOT 5
- [FR] Dark theme option HOT 4
- The tail insert of linked object HOT 1
- Needs introduction to analysis of algorithms HOT 1
- Minor update to the book for nims 2.0 release as of today (01.08.2023) HOT 8
- Re: Permission to use the book in YouTube video series. HOT 3
- Result of some code is not expected as point in the book HOT 5
- Use of word "concept" in place of "defer" HOT 3
- Expand section on templates HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nimprogrammingbook.