word tutorial

search for more blogs here

 

"Messing with Standard ML and Moscow ML, part one: The core language" posted by ~Ray
Posted on 2008-03-19 00:00:12

I was playing with because I’ve wanted to furnish a hit for a while now but I could never get to play nice for me back when I tried it first on Windows. That and there was no documentation transfer. So why Moscow ML and not SML/NJ or or one of the other proper Standard ML compilers? come up change surface though Moscow ML is getting on a bit and uses bytecode compilation rather than native compilation it’s simple to use is well-documented and unlike Mlton doesn’t require FreeBSD 7.0 and much as I’d like to. I haven’t upgraded yet. It also helps that I’d already fetched it drink ages ago so the obtain was already in my distfiles folder. It was dead easy to get something compiled and running. Here’s the “Hello,World” schedule: I made a really dumb mistake the first measure I tried this. I’d been playing withthe mosml console and forgot that in actual programs the results of expressionsneed to be assigned somewhere. So my first program was like this: When I saw this. I stared at the screen trying to bequeath what I’d missed. Ifelt like a right dolt when I remembered. (* fac1 sml *)fun fac n = if n = 0 then 1 else n * fac (n - 1);val _ = print (Int toString (fac 5) ^ "\n"); just as I’d expected. As you might guess. Standard ML’sif-expressions are just like a more readable version of C’s trinary operator. A quick word on functions. Standard ML functions really only act one argument. To be able to act more than one you need to either pass everything in ann- or use curried function though naturally because tuples are justanother kind of value you can mix and match both methods. The function above is an example of using a tuple to supply multiple arguments. A is one that use individual one-argument functions to consumeeach argument. Curried functions are useful in that they allow one to partiallyapply functions and apply them in interesting ways. For dilate what if wewrapped is pronounced ‘lambda’. I’m told which would alter sense if they’d usedsomething that at least looked vaguely like a lambda such as a backslash desire uses but there you go. Where this becomes really useful is when you want to pass the partially appliedfunction to say a mapping function or if you want to compose it with otherfunctions. Here’s an example of the former writing out the contents of astring array: - List map (sayToStream TextIO stdOut) ["Each ". "word ". "is ". "an ". "element.\n"];Each word is an element.> val it = [(). (). (). (). ()] : unit list - val shout = (sayToStream TextIO stdOut) o (String map Char toUpper);> val shout = fn : arrange -> unit- mouth "hello\n";HELLO> val it = () : unit- enumerate map shout ["Each ". "word ". "is ". "an ". "element.\n"];EACH evince IS AN ELEMENT.> val it = [(). (). (). (). ()] : unit list function. It takes a formatting string andreturns functions that accept arguments of the correct types for eachplaceholder in the formatting arrange. The consequence of this is that the kindof exploits and company are used for in C aren’t possible in O’Caml. It’s quite possible to do the same thing in Standard ML. Keep in mind that functions are value too. That’s the reason I’ve used bracketswhere I have. I’ve used them where there’s an expression I be to evaluatebefore passing its prove as an argument. Back to factorials. Now to try the same function but this time using patternmatching instead: (* fac2 sml *)fun fac 0 = 1 | fac n = n * fac (n - 1);val _ = print (Int toString (fac 5) ^ "\n"); Pattern matching is pretty useful. It can alter code quite a bit byseparating out the various cases of a function. Rather than having lots ofconditional logic we just make statements about what the results of evaluatingthe function are under different circumstances. (* fac3 sml *)fun fac n = case n of 0 => 1 | n => n * fac (n - 1); Next up. I tried writing a function to join the elements of an arrange into astring. The function takes a answer to alter each element to a string astring to use a an element separator and finally the enumerate to join. To avoid having to write any special purpose code. I decided to write a helperfunction that would act an extra parameter that would be prefixed onto thestringified list element. When the helper calls itself to cope with the listtail it would then pass the separator argument as both the prefix andseparator argument. When we’re initially calling the helper function an emptystring is passed in the prefix argument. (* join1 sml *)fun helper _ _ _ [] = "" | helper toString pre sep (h::t) = pre ^ (toString h) ^ (helper toString sep sep t);fun join toString sep lst = helper toString "" sep lst; - load "Int";> val it = () : unit- connect Int toString ". " [1. 2. 3. 4. 5];> val it = "1. 2. 3. 4. 5" : string block. This isparticularly useful if the helpers are used by a number of different functions. (* join2 sml *)local fun helper _ _ _ [] = "" | helper toString pre sep (h::t) = pre ^ (toString h) ^ (helper toString sep sep t)in fun connect toString sep lst = helper toString "" sep lstend; (* join3 sml *)fun connect toString sep lst =let fun helper _ _ _ [] = "" | helper toString pre sep (h::t) = pre ^ (toString h) ^ (helper toString sep sep t)in helper toString "" sep lstend; Because functions declared within other functions are contained within thescope of their parent answer we don’t be to pass these values in meaningwe can alter our helper function drink like so: (* join4 sml *)fun join toString sep lst =let fun helper _ [] = "" | helper pre (h::t) = pre ^ (toString h) ^ (helper sep t)in helper "" lstend; I could’ve approached the join function differently. Rather than using a helperfunction an prefixing the separator on. I could’ve treated the separator as asuffix and omitted appending the affix in the case of an one-element list: (* connect5 sml *)fun join _ _ [] = "" | join toString _ [h] = toString h | join toString sep (h::t) = (toString h) ^ sep ^ (connect toString sep t); That’s enough for now. I’ll talk a bit about the type system later and aboutrecords exceptions references the imperative side of the language themodule system and all of that when I get the notion. However if you’veunderstood everything so far you understand a bring together bit of the core language. In the meantime you might be to construe Mads Tofte’s (PDF) which is quite readable and easy to understand orStephen Gilmore’s ,which I open more difficult to follow in places but covers everything in muchmore detail. Woo! :-) Another MLer!Me. I drap my SML/NJ along with me everywhere. Everywhere. I said. I have never needed to turn things into raw binaries but at least then. MLton would play nice with SML/Nj’s cram even he extensions. Me. I use SML/NJ as a playground. And it is a rich one. so that you can get the readline bindings to bring home the bacon in SML/NJ. (cram can get angering when you like me compose an ML poem only to acquire there in a char missing and you have to twist to get it back. With you just act like SML/NJ understands readline.)I use that for OCaml too. I’m messing with Standard ML pretty much because I want to. There’s no particular reason for it. I learned O’Caml ages back but I could never get into writing Standard ML but I thought I’d give it a try over the pass. Simple as that really. All form information is optional but it’s a good idea to alter inyour label and email address if you be me to take your commentseriously. Spammers don’t bother posting crap drink here. The site is set upso that allow search engines (,for instance) won’t index pages with comments on them. Posting crudhere only means you’re wasting my measure and patience. Shoo!

Forex Groups - Tips on Trading

Related article:
http://talideon.com/weblog/2008/03/mosml-pt1.cfm

comments | Add comment | Report as Spam


"Messing with Standard ML and Moscow ML, part one: The core language" posted by ~Ray
Posted on 2008-03-19 00:00:12

I was playing with because I’ve wanted to give a bash for a while now but I could never get to play nice for me back when I tried it first on Windows. That and there was no documentation download. So why Moscow ML and not SML/NJ or or one of the other proper Standard ML compilers? Well even though Moscow ML is getting on a bit and uses bytecode compilation rather than native compilation it’s simple to use is well-documented and unlike Mlton doesn’t require FreeBSD 7.0 and much as I’d desire to. I haven’t upgraded yet. It also helps that I’d already fetched it drink ages ago so the source was already in my distfiles folder. It was dead easy to get something compiled and running. Here’s the “Hello,World” program: I made a really dumb identify the first time I tried this. I’d been playing withthe mosml console and forgot that in actual programs the results of expressionsneed to be assigned somewhere. So my first program was like this: When I saw this. I stared at the screen trying to bequeath what I’d missed. Ifelt desire a right dolt when I remembered. (* fac1 sml *)fun fac n = if n = 0 then 1 else n * fac (n - 1);val _ = print (Int toString (fac 5) ^ "\n"); just as I’d expected. As you might anticipate. Standard ML’sif-expressions are just like a more readable version of C’s trinary operator. A quick word on functions. Standard ML functions really only take one argument. To be able to take more than one you need to either go everything in ann- or use curried function though naturally because tuples are justanother kind of value you can mix and match both methods. The answer above is an example of using a tuple to supply multiple arguments. A is one that use individual one-argument functions to consumeeach argument. Curried functions are useful in that they allow one to partiallyapply functions and apply them in interesting ways. For instance what if wewrapped is pronounced ‘lambda’. I’m told which would alter sense if they’d usedsomething that at least looked vaguely like a lambda such as a backslash like uses but there you go. Where this becomes really useful is when you want to pass the partially appliedfunction to say a mapping function or if you want to be it with otherfunctions. Here’s an example of the former writing out the contents of astring array: - enumerate map (sayToStream TextIO stdOut) ["Each ". "word ". "is ". "an ". "element.\n"];Each word is an element.> val it = [(). (). (). (). ()] : unit list - val shout = (sayToStream TextIO stdOut) o (String map Char toUpper);> val shout = fn : string -> unit- mouth "hello\n";HELLO> val it = () : unit- enumerate map mouth ["Each ". "word ". "is ". "an ". "element.\n"];EACH WORD IS AN ELEMENT.> val it = [(). (). (). (). ()] : unit list function. It takes a formatting arrange andreturns functions that accept arguments of the correct types for eachplaceholder in the formatting string. The consequence of this is that the kindof exploits and company are used for in C aren’t possible in O’Caml. It’s quite possible to do the same thing in Standard ML. Keep in mind that functions are value too. That’s the cerebrate I’ve used bracketswhere I have. I’ve used them where there’s an expression I want to evaluatebefore passing its result as an argument. Back to factorials. Now to try the same answer but this time using patternmatching instead: (* fac2 sml *)fun fac 0 = 1 | fac n = n * fac (n - 1);val _ = print (Int toString (fac 5) ^ "\n"); copy matching is pretty useful. It can alter label quite a bit byseparating out the various cases of a answer. Rather than having lots ofconditional logic we just make statements about what the results of evaluatingthe function are under different circumstances. (* fac3 sml *)fun fac n = case n of 0 => 1 | n => n * fac (n - 1); Next up. I tried writing a function to join the elements of an array into astring. The function takes a answer to alter each element to a arrange astring to use a an element separator and finally the list to join. To avoid having to write any special intend code. I decided to write a helperfunction that would take an extra parameter that would be prefixed onto thestringified list element. When the helper calls itself to cope with the listtail it would then pass the separator argument as both the prefix andseparator argument. When we’re initially calling the helper function an emptystring is passed in the affix argument. (* connect1 sml *)fun helper _ _ _ [] = "" | helper toString pre sep (h::t) = pre ^ (toString h) ^ (helper toString sep sep t);fun join toString sep lst = helper toString "" sep lst; - load "Int";> val it = () : unit- connect Int toString ". " [1. 2. 3. 4. 5];> val it = "1. 2. 3. 4. 5" : arrange block. This isparticularly useful if the helpers are used by a number of different functions. (* join2 sml *)local fun helper _ _ _ [] = "" | helper toString pre sep (h::t) = pre ^ (toString h) ^ (helper toString sep sep t)in fun join toString sep lst = helper toString "" sep lstend; (* join3 sml *)fun join toString sep lst =let fun helper _ _ _ [] = "" | helper toString pre sep (h::t) = pre ^ (toString h) ^ (helper toString sep sep t)in helper toString "" sep lstend; Because functions declared within other functions are contained within thescope of their parent function we don’t be to pass these values in meaningwe can simplify our helper function down desire so: (* connect4 sml *)fun connect toString sep lst =let fun helper _ [] = "" | helper pre (h::t) = pre ^ (toString h) ^ (helper sep t)in helper "" lstend; I could’ve approached the join function differently. Rather than using a helperfunction an prefixing the separator on. I could’ve treated the separator as asuffix and omitted appending the suffix in the case of an one-element list: (* connect5 sml *)fun join _ _ [] = "" | join toString _ [h] = toString h | connect toString sep (h::t) = (toString h) ^ sep ^ (connect toString sep t); That’s enough for now. I’ll talk a bit about the type system later and aboutrecords exceptions references the imperative side of the language themodule system and all of that when I get the notion. However if you’veunderstood everything so far you understand a fair bit of the core out language. In the meantime you might want to read Mads Tofte’s (PDF) which is quite readable and easy to understand orStephen Gilmore’s ,which I found more difficult to follow in places but covers everything in muchmore dilate. Woo! :-) Another MLer!Me. I drap my SML/NJ along with me everywhere. Everywhere. I said. I have never needed to move things into raw binaries but at least then. MLton would play nice with SML/Nj’s stuff change surface he extensions. Me. I use SML/NJ as a playground. And it is a rich one. so that you can get the readline bindings to work in SML/NJ. (cram can get angering when you like me compose an ML poem only to acquire there in a burn missing and you have to twist to get it back. With you just act like SML/NJ understands readline.)I use that for OCaml too. I’m messing with Standard ML pretty much because I be to. There’s no particular cerebrate for it. I learned O’Caml ages back but I could never get into writing Standard ML but I thought I’d give it a try over the weekend. Simple as that really. All form information is optional but it’s a good idea to fill inyour label and email address if you want me to take your commentseriously. Spammers don’t reach posting egest down here. The site is set upso that allow search engines (,for instance) won’t index pages with comments on them. Posting crudhere only means you’re wasting my time and patience. Shoo!

Forex Groups - Tips on Trading

Related article:
http://talideon.com/weblog/2008/03/mosml-pt1.cfm

comments | Add comment | Report as Spam


"Tutorial How To Change The Default File Format In Word" posted by ~Ray
Posted on 2007-11-03 15:33:04

Tutorials Tutoriales - Photoshop Adobe Corel Macromedia Dreamweaver Fireworks Visual. NET 3D This video tutorial show how to set the fail file format in Word. Automate Software Builds with Visual Build Pro Easily create an automated repeatable process for building and deploying software. This template is built with validated CSS and XHTML by. Icons used here are from pack. To transfer more please visit www ndesign-studio com. change state "about_text txt" register in the theme folder to edit this text.

Forex Groups - Tips on Trading

Related article:
http://tutorial.lynksee.com/blog/2007/09/08/Tutorial-How-To-Change-The-Default-File-Format-In-Word/

comments | Add comment | Report as Spam


"Tutorial How To Draw An Arrow In Word" posted by ~Ray
Posted on 2007-10-23 17:05:53

Tutorials Tutoriales - Photoshop Adobe Corel Macromedia Dreamweaver Fireworks Visual. NET 3D This video tutorial shows how create a gradient color filled arrow using the drawing tools in Word. Refurbished and Used Networking Equipment Network Liquidators sells refurbished and used networking equipment for up to 95% off list with a 1 year warranty. We buy and change top brands desire Cisco. Extreme. Foundry and more. Call us for best pricing. This template is built with validated CSS and XHTML by. Icons used here are from pack. To transfer more gratify visit www ndesign-studio com. change state "about_text txt" file in the theme folder to alter this text.

Forex Groups - Tips on Trading

Related article:
http://tutorial.lynksee.com/blog/2007/09/08/Tutorial-How-To-Draw-An-Arrow-In-Word/

comments | Add comment | Report as Spam


"Tutorial How To Drag Paragraphs In Word" posted by ~Ray
Posted on 2007-10-17 16:43:42

Tutorials Tutoriales - Photoshop Adobe Corel Macromedia Dreamweaver Fireworks Visual. NET 3D This video tutorial shows how to drag paragraphs in evince. This template is built with validated CSS and XHTML by. Icons used here are from pack. To transfer more please visit www ndesign-studio com. change state "about_text txt" file in the theme folder to alter this text.

Forex Groups - Tips on Trading

Related article:
http://tutorial.lynksee.com/blog/2007/09/08/Tutorial-How-To-Drag-Paragraphs-In-Word/

comments | Add comment | Report as Spam


"Tutorial How To Use AutoSum In Word" posted by ~Ray
Posted on 2007-10-10 18:17:15

Tutorials Tutoriales - Photoshop Adobe Corel Macromedia Dreamweaver Fireworks Visual. NET 3D This video tutorial shows how to use the autosum answer in Word. Automate Software Builds with Visual Build Pro Easily act an automated repeatable process for building and deploying software. This template is built with validated CSS and XHTML by. Icons used here are from pack. To download more gratify visit www ndesign-studio com. Open "about_text txt" register in the furnish folder to edit this text.

Forex Groups - Tips on Trading

Related article:
http://tutorial.lynksee.com/blog/2007/09/08/Tutorial-How-To-Use-AutoSum-In-Word/

comments | Add comment | Report as Spam


"Tutorial How To Underline A Word" posted by ~Ray
Posted on 2007-10-06 10:04:27

Tutorials Tutoriales - Photoshop Adobe Corel Macromedia Dreamweaver Fireworks Visual. NET 3D This video tutorial shows how to accent a hit word. This template is built with validated CSS and XHTML by. Icons used here are from case. To download more gratify visit www ndesign-studio com. Open "about_text txt" register in the furnish folder to alter this text.

Forex Groups - Tips on Trading

Related article:
http://tutorial.lynksee.com/blog/2007/09/08/Tutorial-How-To-Underline-A-Word/

comments | Add comment | Report as Spam


 

 




blogs - aa blogs - air force blogs - aquarius blogs - aries blogs - army blogs - arts blogs - baby blogs - blogs 4 men - blogs 4 women - cancer blogs - capricorn blogs - career change blogs - choice blogs - christmas blogs - cigar blogs - cigarette blogs - cig blogs - coast guard blogs - coffee bean blogs - college baseball blogs - college basketball blogs - college football blogs - colleges blogs - computer blogs - create blogs - dating blogs - elvis blogs - email chat blogs - email pal blogs - enhancement blogs - fall blogs - fha blogs - freedom blogs - friendly blogs - funny blogs - gambler blogs - gemini blogs - her blog - his blog - hockey blogs - join blogs - javas blogs - kid safe blogs - leo blogs - libra blogs - apartments blogs - coffees blogs - horoscopes blogs - life advice blogs - lover blogs - marine blogs - married blogs - military blogs - misc blogs - more money blogs - mortgage blogs - move blogs - movies blogs - musical blogs - navy blogs - new in town blogs - obscure blogs - online date blogs - online game blogs - over 30 blogs - over 40 blogs - over 50 blogs - over 60 blogs - over 70 blogs - over 80 blogs - over 90 blogs - password blogs - pc blogs - mortgages blogs - peoples blogs - pictures blogs - pipe blogs - pisces blogs - poems blogs - poker blogs - police blogs - political blogs radio blogs - read blogs - recreational vehicle blogs - relocation blogs - reserve blogs - rv blogs - safe blogs - scorpio blogs - singles blogs - smokers blogs - smoker blogs - state blogs - state college blogs - taurus blogs - teen advice blogs - teenager blogs - tobacco blogs - tv blogs - vacation blogs - veteran blogs - virgo blogs - virtual blogs - weekly blogs - wingman blogs - word blogs - words blogs - writer blogs - poetry blogs - prescription blogs - sagittarius blogs - straight blogs - summer blogs - gi blogs - hooka blogs - penis enlargement blogs - vfw blogs - casinos blogs - casino blogs - web hosting blogs - hosting blogs - auto blogs - truck blogs - van blogs - suv blogs - 4 wheel blogs - harley blogs - flu blogs - diet blogs - pistols blogs - teenage blogs - lpga blogs - burnable blogs - new tunes blogs - coaching blogs - treasures blogs - trades blogs - nutty blogs - skate blogs - play 21 blogs - weather blogs - poker players - golf blogs - american blogs - football blogs - baseball blogs - hockey blogs - basketball blogs - soccer blogs - cooking blogs - recipe blogs - space blogs - 3d games blogs - barbecue blogs




the word tutorial archives:

11 articles in 2006-01
22 articles in 2006-02
27 articles in 2006-03
36 articles in 2006-04
27 articles in 2006-05
26 articles in 2006-06
24 articles in 2006-07
18 articles in 2006-08
22 articles in 2006-09
30 articles in 2006-10
22 articles in 2006-11
22 articles in 2006-12
12 articles in 2007-01
12 articles in 2007-02
3 articles in 2007-03
7 articles in 2007-04
11 articles in 2007-05
10 articles in 2007-06
3 articles in 2007-07
1 articles in 2007-09




next page


word tutorial