Skip to content

Commit

Permalink
Merge pull request #3 from ambaker1/performance
Browse files Browse the repository at this point in the history
Slight performance boost for SingleMap case
  • Loading branch information
ambaker1 committed Sep 30, 2023
2 parents 6ea5ee4 + 1e8fdb0 commit f3b55c3
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build.tcl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package require tin 1.0
tin import assert from tin
tin import tcltest
set version 0.2
set version 0.2.1
set vutil_version 1.1
set config [dict create VERSION $version VUTIL_VERSION $vutil_version]
tin bake src build $config
Expand Down
Binary file modified doc/ndlist.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion doc/template/version.tex
Original file line number Diff line number Diff line change
@@ -1 +1 @@
\newcommand{\version}{0.2}
\newcommand{\version}{0.2.1}
2 changes: 1 addition & 1 deletion install.tcl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package require tin 1.0
tin depend vutil 1.1
set dir [tin mkdir -force ndlist 0.2]
set dir [tin mkdir -force ndlist 0.2.1]
file copy pkgIndex.tcl ndlist.tcl README.md LICENSE $dir
9 changes: 5 additions & 4 deletions ndlist.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -1778,10 +1778,11 @@ proc ::ndlist::SingleMap {ndims ndlist body {axis 0}} {
set nmap_i($axis) -1
if {$ndims == 1} {
# Base case
set result [uplevel 1 [list lmap x $ndlist "
upvar 1 x x
set result [lmap x $ndlist {
incr nmap_i($axis)
uplevel 1 [list $body]
"]]
uplevel 2 $body
}]
# Check for break
if {$nmap_i($axis) != [llength $ndlist] - 1} {
set nmap_break 1
Expand Down Expand Up @@ -1949,4 +1950,4 @@ proc ::ndlist::range {args} {
################################################################################

# Finally, provide the package
package provide ndlist 0.2
package provide ndlist 0.2.1
2 changes: 1 addition & 1 deletion pkgIndex.tcl
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
if {![package vsatisfies [package provide Tcl] 8.6]} {return}
package ifneeded ndlist 0.2 [list source [file join $dir ndlist.tcl]]
package ifneeded ndlist 0.2.1 [list source [file join $dir ndlist.tcl]]
7 changes: 4 additions & 3 deletions src/ndlist.tin
Original file line number Diff line number Diff line change
Expand Up @@ -1778,10 +1778,11 @@ proc ::ndlist::SingleMap {ndims ndlist body {axis 0}} {
set nmap_i($axis) -1
if {$ndims == 1} {
# Base case
set result [uplevel 1 [list lmap x $ndlist "
upvar 1 x x
set result [lmap x $ndlist {
incr nmap_i($axis)
uplevel 1 [list $body]
"]]
uplevel 2 $body
}]
# Check for break
if {$nmap_i($axis) != [llength $ndlist] - 1} {
set nmap_break 1
Expand Down

0 comments on commit f3b55c3

Please sign in to comment.