escargo 2016-10-06 -- The current contents of this page seem to have completely replaced the historical and intended contents. Was there a bug? Was there an editing error? A reversion would seem to be appropriate.
ycl , short for Yorick's Computing tooLkit, is PYK's collection of miscellaneous procedures and programs.
To download ycl:
fossil clone http://chiselapp.com/user/pooryorick/repository/ycl ycl.fossil
Then, open the fossil and add /path/to/opened/fossil/packages to $auto_path
There is also a helper script, .../ycl/bin/yclrun, which will automatically adjust $auto_path, and can be used as wrapper:
tclsh /path/to/opened/fossil/packages/ycl/bin/yclrun myscript.tcl
There is another helper script for an interactive shell:
tclsh /path/to/opened/fossil/packages/ycl/bin/yclsh
Zipguy 2013-11-24: How about if you put all those files into a folder structure? Even one folder, named 'ycl', or 'app-ycl' would work good. Then you could either zip them (or you could have gz'ed them), or SDX them (into a starkit) which would make it a lot easier to download them? There are way too many files for me to chase, individually, even though they look quite interesting. Probably a version would be good too, so you could check it, and see if you've already downloaded the latest version.
pyk: you can get this by logging into the repository as anonymous, and then choosing to download the zip or tarball for the commit you're interested in.
The documentation appears in the source code immediately prior to each function declaration. It is in a text format which is intended to be reasonably intuitive even without much knowledge of Tcl.
Most packages have test suites (look for files ending in .test), which provide examples.
The script ycl/bin/ycl can be used to call a command in ycl from a shell.
command is a command available in package
From an sh shell:
$ tclsh /cygdrive/c/Users/yorick/Documents/ycl/src/packages/ycl/bin/ycl cmd 'math rand' randprint_256 BUV9z#=Zu=dAi@y^ytLk1LrTKRp35tbqN^LgqkH7Z6
package require ycl::context namespace import [yclprefix]::context::context proc fly {ns args} { puts "$ns is flying!" } proc nofly {ns args} { puts "$ns can't fly!" } context bird bird method fly bird fly bird derive eagle eagle fly bird derive emu emu method fly nofly emu fly #remove emu's restriction set emumethods [namespace ensemble configure emu -map] set emumethods [dict remove $emumethods fly] namespace ensemble configure emu -map $emumethods emu fly
coro relay is a small but complete system that allows cooperating asynchronous coroutines to make and deliver orders.
pipelined backpressure-mediated compute stations.
package require ycl::dir namespace import [yclprefix]::dir
for item in [dir iter /my/dir] { #do stuff }
Very similar in spirit to Generator. Can be used with [for ... in]
package require ycl::iter
A set of iterators
package require ycl::iter::for
See knit.
variable fruits {apple banana orange pear kiwi} proc is_fruit item { variable fruits return [expr {$item in $fruits}] }
The functions, all, any, are, and which' also support an in $list pattern.
all {banana cookie} [list apply [list x {variable fruits; expr {$x in $fruits}} [namespace current]]] all {banana cookie} in $fruits # -> 0
any {banana cookie} [list apply [list x {variable fruits; expr {$x in $fruits}} [namespace current]]] any {banana cookie} in $fruits # -> 1
are {banana cookie} [list apply [list x {variable fruits; expr {$x in $fruits}} [namespace current]]] are {banana cookie} in $fruits # -> {1 0}
which {banana cookie} [list apply [list x {variable fruits; expr {$x in $fruits}} [namespace current]]] which {banana cookie} in $fruits # -> banana
A close-to-drop-in replacement for tcllib's matrix, but with better performance characteristics since it's more careful about avoiding duplication of data during operation.
Together with proc::methods, proc::upmethods, and var::upmethods, compromises an object system much like ycl::context. Its method calling style provides for uplevel 1 to be the object's namespace, and uplevel 2 to be the caller of the method. This turned out to be a little clunky, and ycl shelf is now preferred to this system.
#! /bin/env tclsh package require ycl::ns namespace import ycl::ns::object package require ycl::proc namespace import ycl::proc::*method upmethod die {} {} {} { puts "$_ dies." } object chessman import {name die} chessman $ name unknown namespace eval chessman { upmethod move {} {} {} { puts "$_ doesn't know how to move!" } } object pawn pawn parent chessman namespace eval pawn { upmethod move {} {} {} { puts "$_ is plodding forward" } } object knight knight parent chessman namespace eval knight { upmethod move {} {} {} { puts "$_ gallops forward and to the side" } } object amazon namespace eval amazon { upmethod move {args} {} {} { dict with args {} if {$as ni {knight queen}} { puts "$_ can not move as a $as" } else { puts "$_ is moving as a $as" } } } puts "chessman name is: [chessman $ name]" # -> unknown chessman move # -> ::chessman doesn't know how to move! object pawn1 pawn1 parent pawn pawn1 move # -> ::pawn1 is plodding forward puts "pawn1 name is: [pawn1 $ name]" # -> unknown pawn1 $ name {white a} puts "pawn1 name is now: [pawn1 $ name]" # -> white a object knight1 knight1 parent knight knight1 move # -> ::knight1 gallops forward and to the side object knight3 knight3 parent knight2 knight3 parent amazon knight3 move as queen knight3 move as bishop
package require ycl::dir namespace import [yclprefix]::dir
See ycl shelf
package require ycl::string
Assimilated from Bryan Okley's combobox.
anonymous - 2016-08-26 01:25:05
What is the license on your ycl toolkit? It's not totally clear and there are some GPL'd items hidden in it.
PYK 2016-08-30: Contributors license their contributions independently. As for my contributions, I'm currently handling license requests on a case-by-case basis.