Re: [Wrapl-discussion] How to invoke such method :"@"?
Brought to you by:
rajamukherji
|
From: Raja M. <raj...@gm...> - 2010-05-30 22:40:50
|
On 30 May 2010 10:37, Roman Mishin <rom...@gm...> wrote: > >>> VAR text <- mylist@String.T; >> > > Indeed. I have already used @ to convert an integer to a string in MOD > Bottles. I think I didn't get the very thing that the type itself is used as > an argument. > > You can also use >> >> mylist@(String.T, " ") >> > > I come up with such line: > Out:write(verse[2,0]@(String.T, "") + verse[1]); > I tried it on a Linux machine with the latest Wrapl version and it works. > > but I'm not very happy with this syntax and am still open to suggestions >> about changing it. >> > > Perhaps being not so intuitive at first sight, it seems OK to me. Knowing > that this syntax comes from a general rule of how to call a method, it seems > acceptable. > > The first thought on how to change it is to use something similar to: > mylist @ String.T VIA " "; analogous to :"[]=", and possibly using some > special character :"@~" (mylist @ String.T ~ " ";). This is from my > perspective, however. > Hmm, my idea for using the syntax I chose was that it should be possible to call @ with any number of parameters. I hadn't thought of using a method similar to :"[]=", but will consider it. > > > By the way, you're the first person to seriously try using Wrapl, so the >> online documentation may be a bit lacking in places. I'll try to improve it >> based on your comments. >> >> Also, the Windows port of Wrapl is a bit out of date, I don't think any of >> the versions of @ with 3 or more arguments are implemented in it. Since your >> last comment, I have mostly fixed the Windows port and will put the new >> version on the website within the next week. >> > > Thank you. Most of the time I work on Windows. Recently, though, I set up a > Linux machine to experiment with. If you are interested, here is a little > bit of my experience with Wrapl installation on Linux: > > -- > I set up a fresh Debian-compatible distro - Linux Mint - on VirtualBox. > Then I installed both wrapl-1.7.1041.deb and wredit-1.7.1041.deb. Some > dependencies were installed by package manager. The whole installation went > without an issue. In the shell I got this: > > roman$ wrapl > Error: /usr/lib/libtermcap.so: undefined symbol: setupterm > Error: symbol setupterm not exported from libtermcap > Error relocating [82d7808] /usr/lib/riva/Util/Tecla.riva:93 > > As I found out this relates to the Wrapl interpreter only, not to riva. > "Hello World" scripts were working. > > I searched for "termcap Debian" and found this page > http://archive.debian.net/bo/admin/termcap-compat which explains > incompatibility between termcap and current Debian versions. So I installed > the package mentioned on the page. Yet, it didn't help. The error remained. > > The page also mentions libncurses, so in search for a solution the next > thing I did is installed libncurses5-dev package, since libncurses5 was > already in place. And this did help. Wrapl started right away. > > With not much experience, I think the only missing dependency is some > library in libncurses5-dev package. > Thank you for this useful feedback, I will be sure to add this dependency to the next release. > -- > > Going further, I want to ask how to read this descriptions in > Libraries:Agg:List: > > :"="(_ @ T, _ @ T, _ @ Agg.ObjectTable.T) > Does it compare two lists? [1, 2] = [1, 2]; I am getting "failure". > I think this method is only defined in the latest version, which I have just uploaded to the website, along with an updated Windows version (any feedback on this is appreciated). The Windows version is still missing a few modules, in particular all the Gtk based modules, and for now the Stat.* and Math.Random modules, since they haven't been ported to build correctly on Cygwin yet. > What is third argument? > Does underscore have special meaning in descriptions or it just denotes > "something"? > Yeah, _ is just used to denote "something", it is automatically generated by the documentation generator whenever actual descriptions are missing. It is also used for value paramters (=) since the parameter name doesn't really matter. > > > :"@"(_ @ T, _ = Std.String.T) > this seems similar to: > :"@"(list @ T, _ = Std.String.T, sep @ Std.String.T) : Std.String.T > but without separator and it does not define return type. It works: > The former returns a Std.String.T like the latter, but hasn't been documented yet. > --> VAR s <- mylist@String.T; > [one, two, three] > --> ? s; > C:\Wrapl\lib\Std\String.T > But I honestly wonder, is this practical after a conversion to have a > string formatted as list? > The list is actually converted into a string in this form, no formatting of the string is performed afterwards. This conversion is mainly intended for displaying the list. The second method for converting a list to a string (with a seperator) is probably more useful within an application. > > -- > Roman > Raja |