Abridged summary of comp.lang.tcl@googlegroups.com - 35 updates in 8 topics

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Abridged summary of comp.lang.tcl@googlegroups.com - 35 updates in 8 topics

comp.lang.tcl mailing list
Cecil Westerhof <[hidden email]>: Jun 07 05:56PM +0200

I often want an event loop that runs forever and terminates when there
is an error. for this I created the proc startEventLoop.
 
You can find it here:
http://wiki.tcl.tk/55367
 
-- ...more
Rich <[hidden email]>: Jun 07 05:11PM

> is an error. for this I created the proc startEventLoop.
 
> You can find it here:
> http://wiki.tcl.tk/55367
 
One small tip, if you perchance ever wanted to exit the event loop (by ...more
Cecil Westerhof <[hidden email]>: Jun 07 07:44PM +0200

> making the "forever" variable inside the proc a global.
 
> As it is a local now, there is no way to set it (because it is proc
> local) after you do get into the event loop.
 
...more
Rich <[hidden email]>: Jun 07 08:13PM


>> As it is a local now, there is no way to set it (because it is proc
>> local) after you do get into the event loop.
 
> Well, the idea is that it runs forever. ;-)
 
Normally, yes. ...more
Cecil Westerhof <[hidden email]>: Jun 07 06:37AM +0200

Often I want to split a string on repeating white-space. The normal
split function does not do what I want. That is why is created the
proc splitOnWhiteSpace:
http://wiki.tcl.tk/55362
...more
Lawrence Woodman <[hidden email]>: Jun 07 05:52AM

On Thu, 07 Jun 2018 06:37:38 +0200, Cecil Westerhof wrote:
 
> http://wiki.tcl.tk/55362
 
> Beside splitting on repeating white-space it can also check the number
> of elements of the split.
...more
heinrichmartin <[hidden email]>: Jun 06 11:31PM -0700

On Thursday, June 7, 2018 at 7:52:07 AM UTC+2, Lawrence Woodman wrote:
> On Thu, 07 Jun 2018 06:37:38 +0200, Cecil Westerhof wrote:
> > Often I want to split a string on repeating white-space.
...more
[hidden email]: Jun 06 11:47PM -0700

About four times faster compared to the regexp-line:
 
list {*}[string map {\{ \\\{} $value]
 
The string map is needed to avoid unmatched open braces in lists. If you know, that there will never ...more
Cecil Westerhof <[hidden email]>: Jun 07 09:20AM +0200


> The string map is needed to avoid unmatched open braces in lists. If you
> know, that there will never be an opening brace in your inputs, you can
> get it even faster.
 
Implemented it in my ...more
heinrichmartin <[hidden email]>: Jun 07 01:04AM -0700

> About four times faster compared to the regexp-line:
 
> list {*}[string map {\{ \\\{} $value]
 
Thanks for measuring. After adding the quote character to the map, its two times faster here. ...more
[hidden email]: Jun 07 01:08AM -0700

> I wondered whether we missed other cases, but didn't find quickly how list parsing is defined.
 
True. The map must ensure a well-formed list. My ad-hoc-implementation did not consider other ...more
Cecil Westerhof <[hidden email]>: Jun 07 10:06AM +0200


> The string map is needed to avoid unmatched open braces in lists. If you
> know, that there will never be an opening brace in your inputs, you can
> get it even faster.
 
I changed the ...more
Lawrence Woodman <[hidden email]>: Jun 07 08:22AM

On Wed, 06 Jun 2018 23:31:46 -0700, heinrichmartin wrote:
 
> this is not \{a list
> expect [~]llength [regexp -all -inline {\S+} $foo]
> 5
 
That's really interesting, I hadn't thought of that. ...more
heinrichmartin <[hidden email]>: Jun 07 01:57AM -0700

On Thursday, June 7, 2018 at 6:44:05 AM UTC+2, Cecil Westerhof wrote:
> Often I want to split a string on repeating white-space. The normal
> split function does not do what I want.
...more
Cecil Westerhof <[hidden email]>: Jun 07 11:52AM +0200


> It looks like this should be rephrased to "backslash substitutions are
> performed according to rule [9]" and we should be fine with the string
> map {\{ \\\{ \" \\\" \\ \\\\}.
...more
heinrichmartin <[hidden email]>: Jun 07 03:18AM -0700

On Thursday, June 7, 2018 at 11:59:04 AM UTC+2, Cecil Westerhof wrote:
> The quote is necessary (I should have thought about that), but the
> backslash is not.
 
The {*}-introduces another round of ...more
Rich <[hidden email]>: Jun 07 10:19AM

> http://wiki.tcl.tk/55362
 
> Beside splitting on repeating white-space it can also check the number
> of elements of the split.
 
That is a lot of Tcl (to write and to execute) when this ...more
Cecil Westerhof <[hidden email]>: Jun 07 01:23PM +0200


> set value \\n ;# the string is backslash-n
> lindex [string map {\{ \\\{ \" \\\"} ${value}] end ;# returns a newline character
> lindex [string map {\{ \\\{ \" \\\" \\ \\\\} ${value}] end ;# ...more
Cecil Westerhof <[hidden email]>: Jun 07 01:27PM +0200

> x
> y
> z
 
That was the way I did it originally, but I was told that the
implemented variant is about four times as fast.
 
I hope that the edge case are now taken care of. ;-)
...more
Rich <[hidden email]>: Jun 07 03:07PM

>> z
 
> That was the way I did it originally, but I was told that the
> implemented variant is about four times as fast.
 
Did you perform any timing tests yourself?
 
I ask because this ...more
Brad Lanam <[hidden email]>: Jun 07 09:59AM -0700

On Thursday, June 7, 2018 at 8:07:29 AM UTC-7, Rich wrote:
 
> > I hope that the edge case are now taken care of. ;-)
 
> Well, that is one advantage of the regex method, *all* the edge conditions ...more
Rich <[hidden email]>: Jun 07 05:07PM


> Did you time it with this typo? Or without?
> regexp regexp
> Just checking as the typo does not return an error.
 
Sadly, with the typo.
 
Removing the typo, I get (for several runs):
...more
Brad Lanam <[hidden email]>: Jun 07 10:24AM -0700

On Thursday, June 7, 2018 at 10:07:19 AM UTC-7, Rich wrote:
> I don't understand the variance, but the regex version is faster, or at
> least equal, to the code version over these runs.
...more
Cecil Westerhof <[hidden email]>: Jun 07 07:27PM +0200


>> I hope that the edge case are now taken care of. ;-)
 
> Well, that is one advantage of the regex method, *all* the edge conditions
> are taken care of already.
 
No, it was mentioned here. ...more
Cecil Westerhof <[hidden email]>: Jun 07 07:40PM +0200

> 4.286 microseconds per iteration
> Regex engine:
> 4.755 microseconds per iteration
 
Well, the non regex version is not significant faster as the regex
version. So the regex version seems ...more
Cecil Westerhof <[hidden email]>: Jun 07 08:24PM +0200

> 4.286 microseconds per iteration
> Regex engine:
> 4.755 microseconds per iteration
 
It was not an honest comparison. I changed the proc so that a
parameter decides which version is going to be ...more
Andreas Otto <[hidden email]>: Jun 07 03:42AM -0700

after thinking about. I would call these operators as follow…
 
= → native
* → glob
~ → regexp
 
== → compare with native
=* → compare with glob
=~ → compare with regexp
...more
Andreas Otto <[hidden email]>: Jun 07 03:45AM -0700

> ...
> }
 
> matchre should be a procedure residing in the (relative) namespace tcl::mathfunc.
 
yes… If done it after your recommendation…
 
proc tcl::mathfunc::regexp {var rx} { ...more
heinrichmartin <[hidden email]>: Jun 07 05:09AM -0700

On Thursday, June 7, 2018 at 12:42:11 PM UTC+2, Andreas Otto wrote:
 
> != → inverse
> !* → inverse
> !~ → inverse
 
I was thinking the very same: introducing 3-character-operators did not ...more
Cecil Westerhof <[hidden email]>: Jun 07 12:13PM +0200

I have the following code:
set splitLst [list {*}[string map {
\{ \\\{
\" \\\"
} ${value}]]
 
This works without a problem, but on the WiKi everything from the ...more
[hidden email]: Jun 06 10:48PM -0700

get laid tonight near me
 
 
...more
[hidden email]: Jun 06 10:48PM -0700

get laid tonight near me
 
 
...more
Cecil Westerhof <[hidden email]>: Jun 07 06:51AM +0200

On the WiKi I created a page 'Categorie Utilities' instead of
'Category Utilities'. How do I delete it?
 
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: ...more
Cecil Westerhof <[hidden email]>: Jun 07 07:02AM +0200


> On the WiKi I created a page 'Categorie Utilities' instead of
> 'Category Utilities'. How do I delete it?
 
Found it: I had to change the text to a single space.
 
--
Cecil Westerhof ...more
Mike Griffiths <[hidden email]>: Jun 06 01:40PM -0700

On Wednesday, 6 June 2018 10:20:52 UTC+1, heinrichmartin wrote:
 
> Notes:
> * Considering variable context only, [set token] might go inside [try]; but if [::http::geturl] failed, then token is ...more
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to [hidden email].