Tcl-Core Digest, Vol 46, Issue 4 | Korea Tcl/Tk Community

Tcl-Core Digest, Vol 46, Issue 4

admin의 아바타

Send Tcl-Core mailing list submissions to
tcl-core@lists.sourceforge.net

To subscribe or unsubscribe via the World Wide Web, visit
https://lists.sourceforge.net/lists/listinfo/tcl-core
or, via email, send a message with subject or body 'help' to
tcl-core-request@lists.sourceforge.net

You can reach the person managing the list at
tcl-core-owner@lists.sourceforge.net

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Tcl-Core digest..."

Today's Topics:

1. Re: TIP #363: Vector Math in the Tcl Core (David Smith)
2. Re: Patch 2962373 awaiting review: tzdata2010c (Damon Courtney)
3. Re: TIP #363: Vector Math in the Tcl Core (Karl C. Hansen)
4. Re: TIP #363: Vector Math in the Tcl Core (Andreas Kupries)
5. Re: TIP #363: Vector Math in the Tcl Core (Twylite)
6. Re: TIP #363: Vector Math in the Tcl Core (Donal K. Fellows)
7. Re: TIP #363: Vector Math in the Tcl Core (Larry W. Virden)
8. passing tcl "structs"(array of structs) as parameters (C S)

----------------------------------------------------------------------

Message: 1
Date: Thu, 4 Mar 2010 09:12:57 -0800
From: David Smith
Subject: Re: [TCLCORE] TIP #363: Vector Math in the Tcl Core
To: "Neil.Madden@nottingham.ac.uk" ,
Alexandre Ferrieux
Cc: "tcl-core@lists.sourceforge.net" ,
"Karl C. Hansen"
Message-ID:

Content-Type: text/plain; charset="iso-8859-1"

I added Vector/Matrix/Array operators to Tcl about 19 years ago. In doing so I did it with a handle based approach since textually displaying large vectors and mutli-dimensional arrays is not particularly useful. I also added waveforms for EDA at the same time and that deals with large data sets.

The core change was to overload all the operators (plus add a few) to know about the new types. The new operators had to do with defining slices of arrays using a syntactical notation the parser knows about plus some matrix operators.

Doing things with lists I think is not a great idea. The underlying data structure does not support an efficient mechanism for defining slices into large datasets that does duplicate storage. The other incompatible syntax changes are also undesirable.

I can provide more details on this if anyone is interested. I passed it to John O. and Scriptics a long time ago and they did not see a lot of demand for the functionality.

Regards
David

David W. Smith
Synopsys Scientist
?
Synopsys, Inc.
Synopsys Technology Park
2025 NW Cornelius Pass Road
Hillsboro, OR 97124

Voice: 503.547.6467
Main:? 503.547.6000
Cell:??? 503.560.5389
FAX:?? 503.547.6906
Email: david.smith@synopsys.com
http://www.synopsys.com
?
Saber Accelerates Robust Design
Predictable. Repeatable. Reliable. Proven.

-----Original Message-----
From: Neil Madden [mailto:nem@Cs.Nott.AC.UK]
Sent: Thursday, March 04, 2010 8:36 AM
To: Alexandre Ferrieux
Cc: tcl-core@lists.sourceforge.net; Karl C. Hansen
Subject: Re: [TCLCORE] TIP #363: Vector Math in the Tcl Core

Alexandre Ferrieux wrote:
> On 3/4/10, Karl C. Hansen wrote:
>> TIP #363: VECTOR MATH IN THE TCL CORE
>> =======================================
>>
>> With the proposed enhancement, and a vector-math core enhancement,
>> given the assignments above, the following would behave identically:
>>
>> expr $ListA + {4 5 6}
>> expr $ListA + $ListB
>> expr {1 2 3} + $ListB
>> expr {1 2 3} + {4 5 6}
>
> So basically you're proposing to break just about everything in Tcl
> parsing to avoid writing a simple proc for vector/matrix/tensor
> computations ?
>
> proc myexpr {x op y} {
> if {[llength $x]==1} {return [expr $x $op $b}
> if {[llength $x]!=[llength $y]} {error "Dimension mismatch"}
> set z {}
> foreach a $x b $y {lappend z [myexpr $a $op $b]}
> return $z
> }
>
> # The following four do the same today without breaking anything:
> myexpr $ListA + {4 5 6}
> myexpr $ListA + $ListB
> myexpr {1 2 3} + $ListB
> myexpr {1 2 3} + {4 5 6}

Or just Brace Your Exprs (TM) and then write a TIP which actually proposes what the title suggests: adding vector versions of operators to [expr], such that [expr {$ListA + {4 5 6}}] does what makes sense.

-- Neil

------------------------------

Message: 2
Date: Thu, 4 Mar 2010 11:55:46 -0600
From: Damon Courtney
Subject: Re: [TCLCORE] Patch 2962373 awaiting review: tzdata2010c
To: Tcl Core List
Message-ID: <904B8649-FE8B-4FE5-988A-7101B32A5007@tclhome.com>
Content-Type: text/plain; charset=us-ascii

> Possibly. It's an idea like the old "SourceForge compile farm;"
> we'd perhaps do well, before doing anything like that, to try
> to determine what issues killed it, so that our ship doesn't
> founder on the same rock.

SourceForge killed the compile farm themselves. If I recall, it was mainly just a pain for them to manage and it cost more money than it was worth. BitMover will always have its server farm. It's how we build our software, so there's no chance of it going away. We do periodically remove nodes from the cluster as we deprecate a platform, but we support a helluva lot of platforms.

That being said, if we could work out the security issues, I think it would be awesome. For the record, we already compile Tcl / Tk 8.6 on every platform that Larry listed since we ship them with our product. We've had to make a few small build adjustments over the years as the Tcl maintainers have deprecated platforms before we do, but we still build Tcl/Tk on every platform every time we crank. We don't run the test suite though that I'm aware of. I'm pretty sure we run the L test suite, but I don't know if we run the entire Tcl/Tk regressions.

It would be an awesome platform for build and release testing if we can work it all out. I would love to see an ActiveTcl-style batteries included release in binary form for all the available platforms. Don't get me wrong, I love ActiveTcl, but there will always be platforms it's not cost-effective for them to support. I've been asking for FreeBSD for years.

D

------------------------------

Message: 3
Date: Thu, 4 Mar 2010 09:24:29 -0800 (PST)
From: "Karl C. Hansen"
Subject: Re: [TCLCORE] TIP #363: Vector Math in the Tcl Core
To: Neil.Madden@nottingham.ac.uk
Cc: "Karl C. Hansen" ,
tcl-core@lists.sourceforge.net
Message-ID:
<86cc9dfc70bf1a9b75afbbc2aa9b07d2.squirrel@webmail.shire.net>
Content-Type: text/plain;charset=iso-8859-1

>> So basically you're proposing to break just about everything in Tcl
>> parsing to avoid writing a simple proc for vector/matrix/tensor
>> computations ?
>>
>> proc myexpr {x op y} {
>>...
>> }
>>
>> # The following four do the same today without breaking anything:
>> myexpr $ListA + {4 5 6}
>> myexpr $ListA + $ListB
>> myexpr {1 2 3} + $ListB
>> myexpr {1 2 3} + {4 5 6}
>
> Or just Brace Your Exprs (TM) and then write a TIP which actually
> proposes what the title suggests: adding vector versions of operators to
> [expr], such that [expr {$ListA + {4 5 6}}] does what makes sense.

Alexandre - that and a dozen other ways force it to work in the existing
system but not in a way that is integrated and *fast*. To do it with
compiled code I would have to essentially rewrite the entire expr engine
to handle vectors.

Neil - intriguing idea. I had not tried it, and it turns out that:

expr {1 + {2 3 4}}

gives

can't use non-numeric string as operand of "+"

I'll have to track down that error message, but if it is occurring at the
math-handler rather than in the expression tree this may be a possible
approach.

One positive side-effect of the proposed approach is that it essentially
"reverses" what is done by '{*}' when using 'eval' strings. For example,
these work:

set A 1
eval set B $A

but these do not:

set A {1 2 3}
eval set B $A

Why? Because of the "hidden"
'convert-everything-in-rest-of-line-to-string' that strips the fact that A
is a list, so you end up with multiple values for the 'set' command.

The {*} operand satisfied the need to be able to turn a list into multiple
arguments for calling a procedure without having to use eval.

The proposal fixes the above so that B *always* gets a list, because
that's what A *is*.

With the proposal, you get symmetric behavior.

* If you want a list broken into pieces when used, prefix with {*}$varname.
* If you want a list preserved as a single entity, just use $varname.

I welcome the discussion. It took some time before '{*}' was accepted,
and in the end it is extremely useful. I am hopeful this will precipitate
a way to get vector math into the core so that it becomes a tool capable
of going head-to-head with the high-end engines out there.

Best Regards,

Karl

------------------------------

Message: 4
Date: Thu, 04 Mar 2010 11:14:30 -0800
From: Andreas Kupries
Subject: Re: [TCLCORE] TIP #363: Vector Math in the Tcl Core
To: David Smith
Cc: "Neil.Madden@nottingham.ac.uk" ,
"Karl C. Hansen" ,
"tcl-core@lists.sourceforge.net"
Message-ID: <4B900696.2000404@activestate.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On the package side there is

http://tcl-nap.sourceforge.net/

--
Sincerely,
Andreas Kupries
Developer @

------------------------------

Message: 5
Date: Thu, 04 Mar 2010 21:40:42 +0200
From: Twylite
Subject: Re: [TCLCORE] TIP #363: Vector Math in the Tcl Core
To: tcl-core@lists.sourceforge.net
Cc: "Karl C. Hansen"
Message-ID: <4B900CBA.20906@crypt.co.za>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Karl C. Hansen wrote:
> TIP #363: VECTOR MATH IN THE TCL CORE
> =======================================
>
> expr $ListA + {4 5 6}
> expr $ListA + $ListB
namespace import tcl::mathop::*
map + $ListA $ListB

What Tcl _could_ do with is higher-order functions like map, filter,
foldl/reduce, foldr, and range/iota in the core.

My 2c,
Twylite

------------------------------

Message: 6
Date: Thu, 04 Mar 2010 21:52:00 +0000
From: "Donal K. Fellows"
Subject: Re: [TCLCORE] TIP #363: Vector Math in the Tcl Core
To: Twylite
Cc: tcl-core@lists.sourceforge.net
Message-ID: <4B902B80.4010001@manchester.ac.uk>
Content-Type: text/plain; charset="utf-8"

On 04/03/2010 19:40, Twylite wrote:
> What Tcl_could_ do with is higher-order functions like map, filter,
> foldl/reduce, foldr, and range/iota in the core.

You should make a FRQ for that. (A [map] that has [foreach]'s extra
goodness would be rather delicious.)

Donal.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: donal_k_fellows.vcf
Type: text/x-vcard
Size: 241 bytes
Desc: not available

------------------------------

Message: 7
Date: Thu, 4 Mar 2010 16:58:33 -0500
From: "Larry W. Virden"
Subject: Re: [TCLCORE] TIP #363: Vector Math in the Tcl Core
To: tcl-core@lists.sourceforge.net
Message-ID:
<5868906b1003041358p26f32e7bu2cef49084659d57@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

When I read the subject line, I thought perhaps someone was going to propose
taking the BLT vector data structure and building it into Tcl core...
-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 8
Date: Thu, 4 Mar 2010 23:23:40 -0800 (PST)
From: C S
Subject: [TCLCORE] passing tcl "structs"(array of structs) as
parameters
To: tcl-core@lists.sourceforge.net
Message-ID: <56646.69015.qm@web31604.mail.mud.yahoo.com>
Content-Type: text/plain; charset=us-ascii

I have a tcl struct that i have created somewhere in my program like so:

set array(0.x) 10
set array(0.y) 20
set array(0.z) 30

lets say i have 20 of these structs that have been filled with data.

I want to pass this to a proc and be able to retrieve the data(or print it out) but keep getting errors. i would also like to change values on the fly so that the original array also changes. I actually have this part working...so naturally i am confused as to why i cannot access the array when trying to output it to the screen.

Can anyone help? Thanks much in advance.

***so if i have:***

proc print_array {arr} {

upvar arr a

#set a(0.x) 25 <---update this value

#puts "$a(0.x)" <---Error in startup script: can't read "a(0.x)": no such element in array while executing "puts "$a(0.x)""
}

and in my main somewhere i have created and filled the array with values so i call the proc:

print_array myArray

puts "$myArray(0.x)" <---this prints out the changed value successfully from up in the proc.

------------------------------

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev

------------------------------

_______________________________________________
Tcl-Core mailing list
Tcl-Core@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tcl-core

End of Tcl-Core Digest, Vol 46, Issue 4
***************************************