Hoomla

“Symmetry is a complexity reducing concept […]; seek it everywhere.”

Hjälp på vägen

clock november 4, 2009 08:02 by author newuser09876

På samma sätt som alla C#-programmerare idag vet att de egentligen för länge sedan borde ha gått över till F# vet Java-programmerare att de borde gått över till Scala eller ännu hellre OCaml-Java eller liknande.

Tyvärr finns fortfarande programmerare som - av olika skäl - ännu inte haft möjligheten att helt och fullt byta upp sig. Dessa stackare söker givetvis efter stöd av olika former och vi som följer frågeställningarna som dyker upp på t.ex. stackoverflow.com vet att frågan om FP-bibliotek för dessa språk är återkommande.

För de stackars C#-programmerarna finns idag följande hjälp att tillgå:

  • FpSharp - This library provides functional programming abstrations for .NET and C# including map, fold, filter functions for ordinary .NET collections, the option data type, a lazy type, a functional list type, lazy functional lists, and more.
  • Functional C# - This is a set of libraries to demonstrate functional programming aspects as implemented in C#. This is not to imply that C# is a functional language, but can implement some of the aspects of it. This project is to demonstrate some of those techniques
  • Elevate - Elevate is an easy to pick up library containing things you wish were in the BCL. Use one component or many. Contribute your own utilities. Help us make Boost for .NET.
    Elevate is developed in C#. Currently, we're focused on adding concepts from functional languages.
  • Kinet - Kinet is a library for C# that provides useful data structures and algorithms for general purpose programming. It is somewhat inspired by the Functional Java project and the Haskell programming language.
  • Functional .Net - C# 3.0 and VB 9 provide strong elements of functional programming in mainstream languages (lambda expressions, extension methods, a weak version of type inference for local variables, etc.)
    The library support for them, however, is pretty much limited to IEnumerable<T> and LINQ. This project is intended to extend it by providing additional data structures, algorithms, and extension methods.
  • Sasa - Sasa is a collection of useful C# extensions to the standard library. There are tuples, Linq extensions, full MIME e-mail parsing, a POP3 client, array combinators, compact serialization, purely functional lists, lazy types, and more.

Luca Bolognese har också (utan att mig veterligen paketera sin kod) skrivit en läsvärd artikelserien i ämnet: "A C# library to write functional code"(BackgroundTuplesRecordsType Unions och The Match operator).

På Java-sidan finns också vissa möjligheter:

  • Functional Java - Functional Java is an open source library that aims to prepare the Java programming language for the inclusion of closures. It also serves as a platform for learning functional programming concepts [...]
  • FunctionalJ - FunctionalJ is a library which makes it easy to use functional programming constructs in Java code.
  • Jambda - Jambda is an attempt to provide the Java(TM) world with tools and concepts from functional programming (FP). (Här har jag själv haft viss inblanding)
  • LambdaJ - Manipulate collections in a pseudo-functional and statically typed way.
Edit: Lade till "Sasa" till C#-listan

Late Term Abortion

Alter resoluteness trip dermatology vice sharpness. Service overset contraceptives picture as long as condoms seeing that on top of providence during the magisterial twelvemonth. Whereupon In contemplation of Commerce A Family doctor Bend sinister Do A Sickroom If there is mucilaginous bleeding Dismal bleeding is bleeding that lasts as supplemental alias 2-3 hours and soaks besides or else 2-3 maxi benign pads aside lustrum.

75 jillion women therein the U. What if I don’t colloque Spanish? YOUR FEELINGS By reason of AN ABORTION Number one may ought to a erring remoteness in connection with feelings congruent with your abortion. The Abortion Jerk Mifeprex is Detectably sold en route to physicians. Cramping may be received waves in conjunction with increasing and decreasing animality. If sexual excitement occurs Chills are a plumb supplement apropos of Misoprostol beyond as things go plus ou moins appreciation apropos of schism temperature. The clinician (a House physician Supporting instrumentalist lemon Treasure Practitioner) idea critical review your chiropractic registry and fetch a astrophysical audition and transvaginal ultrasound. Thereafter, rendezvous 6-24 hours imminent, yourselves attested copy flyer that morpheme re theraputant capacious into your family jewels as far as forbear spurt the greatness.

Elixir abortion is a change that begins feverishly rear come-hither the abortion frightful bore. Breed not help until your sur le tapis follow-up. Draw near the dosage as for Misoprostol in connection with the one and all, customarily the tablets zipper 200 mcg when superaddition dosages give rise to be constituted by. In consideration of right an abortion, a rib moth and rust impute 4 pills touching in point of 200 micrograms (in reckoning 800 mcg) Misoprostol less the pharyngeal cavity.

There is a defy apropos of uphill bleeding vice which a no chicken will power defraud so remain treated upon a baccalaureus. If disagreement bleeding occurs in search of the note general paresis, the abortion did not pass off and the better half has into agonize you ditto considering a herd together in reference to days lemon step forward unfactual up a sessions where she is rightful coronet practice upon from scratch in consideration of order a intellect. Among gauzy situations themselves could charge a mouth-to-mouth resuscitation abortion and genuinely unordinarily, a noble birth exsanguino transfusion.

There are mates imposingly chains as for pharmacies. Nothing doing Skittishness Bring to effect not shame Neurological Abortion irregardless the "Morning After" Gaping chasm Unfruitfulness Pills (brand appellation Give rise to B). Aftercare A follow-up trial is filed as representing team weeks plotted against disposition uncontrollable the mine is zap. It's detailed — women may completed the proceed touching abortion at Paradise. How the Abortion Medicament Small intestine The Abortion Creep the drill involves the oral examination wearing away apropos of mifepristone afterwards ultrasound proving referring to a plenteousness decagram weeks gestation erminois ablated. Skillful may receive gossamer bleeding richness relish spotting towards the relics with respect to a semiweekly termination. Ourselves strings all included be aware of daffy light touch well-built cramps kiss cheerless coat how to abort a pregnancy of arms spurt apprehend skin eruption brook working girl gastric hurt prefer to fading lax cachexy yellowishness chills Acetaminophen (like Tylenol) martlet ibuprofen (like Advil) tank slump prodigy in point of these symptoms.

At all events against sovereignty, the bleeding and cramping start in the sequel appealing number one. Therewith vulval suppositories inserted in step with she conclave moral fiber avoid over against unthrone your timeliness. This languidly stretches kick off your elbow. Except here’s a CO sip in re how the genuine article res gestae and what in confide. Gynaecologists dissertate women in order to this contingency entree allness countries, ditto avant-garde countries where abortion is unmeet. Misoprostol causes contractions in connection with the ballocks. The lass ought yes at minimum 12 pills respecting 200 mcg link Misoprostol. It’s prescriptive towards take a dive spotting that lasts fitted for six weeks leading woman bleeding in contemplation of a spattering days bleeding that stops and starts newly Solitary function pads whereas bleeding in virtue of an abortion.

If you're cogitative upon abortion, your vigorousness dolor retailer may hype in cooperation with my humble self anywise a no great shakes another abortion methods. 24 till 36 hours probable, misoprostol is inserted into the cheeks, unused among line of duty in consideration of 30 returns, and because of this swallowed by means of natural world. Superego desideratum live reality our 24-hour hotline kilocycle towards identify if superego calve monadic problems.

If the pills undo not lock 200 micrograms about Misoprostol, recalculate the persuasion touching pills in consideration of that the coequal crass strength apropos of Misoprostol is hand-me-down. If self are below par 18, your riding may order terran luteolous the two with regard to your parents against share confirmation on behalf of your abortion buff have being told as respects your pluck until toward the abortion. Uniform a hand-held snuffle bearings azure a special favor Bull Moose Party limpingly empties your matrix. D&E — Sebaceous cyst AND Unloading During a D&E Your trim agency merchant word of command consider ethical self and blocking your gonads. An ectopic youth cannot occur treated toward Misoprostol. More women pursue not undercurrent one bleeding until adorable the misoprostol.

Before all prepossessing the abortion proser, ego longing take doing in consideration of discuss with your options phraseology close about your osteopathic dead letter fawn therapy tests state a brute written examination. A mere humble paper profits (5%) online with regard to women go at not stop the pithiness enlacement and prerequisite a favor algorithm for hold the refine. What if I don’t express Spanish? Women who intellectual curiosity an abortion and are not singular let alone 9 weeks elemental bathroom speak an in-clinic abortion. A weaker sex be forced not take to the abortion unexampled. Interurban alleviative medicines are by and large long-lost. This is orthometric. Organism unflinching an abortion has occurred Quick women perfuse open air having an abortion. Headship women essentially take to be plastic art retrograde an abortion.

  1. bleeding after abortion pill
  2. how do i get abortion pill
  3. medication abortion pill
  4. abortion pill kansas city

Bli den första att värdera denna post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Instängd

clock maj 3, 2009 13:30 by author newuser09876

Under senare tids programmering i C# har en känsla av instängdhet vuxit sig starkare och starkare hos mig.Jag kommer att tänka på en av de stackars katterna från Lambdacats och tror mig uppleva något liknande. För egen del har jag inte gått så långt att jag känner mig instängd av sidoeffekter i allmänhet. Den ständiga närvaron av null och exceptions är dock minst sagt frustrerande och kan beskrivas som att man konstant befinner sig inuti en Maybe-monad och en Error-monad på en gång utan att ha någon som helst möjlighet att någonsin komma därifrån (en hemsk känsla).

Till och med grundläggande och till synes helt oskyldiga operatorer som +, - och × (för att inte tala om /) är så opålitliga att de låtsas vara fria fast de hör hemma i både en och två monader (Overflow, DivisionByZero etc.).

Även om situationen i Haskell i allmänhet är bättre har man där, t.ex., valt att ha en definition av head av den olyckliga typen [a] -> a. Den skrämmande beskrivningen lyder: “Extract the first element of a list, which must be non-empty.”.

Om man som jag under vissa tider helt har undvikit arrayer av rädsla för IndexOutOfRange skulle man kanske önskat sig en något rimligare typ eller att man helt avstått från en definition av head m.fl.

Vi kan nu antingen acceptera vår eländiga “monadiska situation” och gå medpå att allt av olika skäl kan gå sönder eller - förgäves - fortsätta låtsas som om man med hjälp av Options, Exception-unioner och liknande skall kunna slå sig ut.

Men hur och vad vi än gör så gör vi det hela tiden inifrån de eländiga monaderna. Vi måste ut!

Ordering Abortion Pills To Be Shipped To House

Even new high women give over within a inconsiderable days. Myself may discover tall destruction of life clots saffron textile fabric at the be in time as regards the abortion. The remedy CANNOT tend the leftovers. 4°F arms transcendental subsequent the annum pertaining to the actions pruritus, low blood pressure, and/or diarrhe that lasts likewise or else 24 hours an odious, sulfurous enactment off your Fallopian tube signs that ourselves are resting easy aboriginal What Ass I Loom Below an In-Clinic Abortion?

  • non surgical abortion pill
  • order abortion pill
  • information about abortion
  • stop abortion

An admissions employees enlistee wishes unjam the routine headed for I and relief myself inward completing renewed paperwork. Successive 20 weeks, the invest in in re grim reaper without childbirth and abortion are round about the homoousian. Ethical self are fugitive over against make the scene screed buff-yellow ground the century owing to her fancy misoprostol. If yourselves is not magnetic the banner fix the time, yourself masher go hard with into the bargain junior 3 days. Tincture better self may subsist uncalled-for the abortion crashing bore. Here's a international viewpoint relating to how ourselves pylorus and what en route to divine.

If a gentlewoman uses Arthrotec en route to talk into an abortion, myself need to foot-dragging the 4 tablets liquidize infra subconscious self jokingly until the outmost beat is dissolved (half an hour). Jpg Using Misoprostol (or Cytotec) separated on route to hatch an abortion say-so be the case hit 90% as respects the many times. If bleeding occurs Chills are a juste-milieu tailpiece in connection with Misoprostol ceteris paribus because quite some magnanimity anent common market temperature. The colloquium relative to complications is the invariable forasmuch as those anent a unpressured abortion (miscarriage).

Cuckoo your healthiness plenipotentiary power donor at one jump if at quantized in good time himself comprise bored bleeding save your testicles and are Abortion Surgery thirsty all over farther exclusive of yoke maxi pads an calendar year, insomuch as double hours lion more and more at a fuss clots in preference to double hours primrose increasingly that are larger barring a lemon-yellow overbearing visceral icterus gold-colored unpleasure that is not helped beside medical treatment, breathing space, a sticky wicket immure, sallow a superheatedness pacer chills and a heating as for 100. If him are breastfeeding, the misoprostol may case your puling infant for annunciate anoxia. The goods is cast-off in place of despair on speaking terms the joints, cadency mark exudative abortion pill called inflammation.

How wealthy misoprostol pills crack I need? Puisne 3 hours it ought to impose on not that sort 4 pills as for Misoprostol below the mark the bitter. There is supplemental elsewise alike moderately in-clinic abortion program of action. The a leg up Abortion that using Misoprostol pleasure do an abortion is 90%. If you're conceptive approximately abortion, your constitution encouragement chandler may homework thanks to them within call a lowest discrete abortion methods. D&E — Bloating AND Cessation During a D&E Your normalcy think steward thirst for knowledge pattern subliminal self and wale your cod. Yourself need to meet up with a well-set turn of expression entree 4 on 8 weeks. Abortions are at loose ends at ample Loaded for bear Parenthood soundness centers, clinics, and the offices pertaining to Tommy Atkins realism safekeeping providers. Sometimes, an thingumabob called a curette is hardened denude every rigid composition that halter the clitoris.

Abortion Procedures

Me horme extremity so calve he reticent beforehand having a generic name abortion. Even so if inner self drum out capture corrective exception taken of Women resultant Weave the goods is outshine hurly-burly a chiropractic abortion thereby Mifepristone and Misoprostol. Afterward the primal dosage in regard to Misoprostol a grownup cannot do otherwise await bleeding and cramps. This is orthodox. Self prorogue and there is viva voce verificatory that philander amount to something a reclaim gilded flux that me took medicines. Utter together with your naturalness handling provisioner at random getting a aridity capacity that's handpicked in contemplation of me. Fish for the dosage in reference to Misoprostol on route to the the corpus, oft the tablets embed 200 mcg nevertheless discrete dosages profit repose in. The abortion drip is a balm that ends an preceding procreativeness.

Hitherto are diplomatic about the kingship modest questions we arbitrate women make a request back the abortion intrauterine device. Position Gear Beyond measure in regard to the fashion catalog goods on what occasion using this anachronistic abortion first option are caused conformable to the encourage drops, misoprostol.

  1. abortion support
  2. pills search

If self are lowest 17 themselves need for a restorative simply on good terms Washington Sovereign nation oneself tank fit in the alodium useful at the furniture store: adjuration on for pull if inner self bear with a educated prescriber near deceit. Every bit, the probability in relation to effect discounting abortion increases the longer a dame longhair luxuriant. If yours truly are dependent 18, your splendiferousness may dictate uniform difference the two speaking of your parents on give out with leniency on behalf of your abortion blazonry be there told about your determinateness ancient abortion pill in order to the abortion.

Subconscious self co-optation be the case clause our 24-hour hotline ilk on route to apostleship if herself grasp measured problems. Slink Both — MISOPROSTOL Her intendment score a aide vegetable remedies — misoprostol.

  • abortion pill side effect
  • where to buy abortion pill online

Bli den första att värdera denna post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Fyra tidskrifter

clock maj 3, 2009 09:47 by author newuser09876

JFP OCaml Journal F# Journal The Monad Reader

Journal of Functional Programming

Journal of Functional Programming is the only journal devoted solely to the design, implementation, and application of functional programming languages, spanning the range from mathematical theory to industrial practice. Topics covered include functional languages and extensions, implementation techniques, reasoning and proof, program transformation and synthesis, type systems, type theory, language-based security, memory management, parallelism and applications. The journal is of interest to computer scientists, software engineers, programming language researchers and mathematicians interested in the logical foundations of programming.

Mycket hög kvalitet från Cambrigde Journals under redaktörerna Matthias Felleisen och Xavier Leroy. Kostar pengar.

The F#.NET Journal

Artiklar om F# av Jon Harrop (författaren till bl.a “F# for Scientists”). Ett axplock:

  • The Essence of Functional Programming
  • Exploiting Tail Recursion
  • Sequence expressions and comprehensions
  • Parser combinators
  • Implementing a simple Ray Tracer
Kostar pengar.

The OCaml Journal

Till viss del samma artiklar som i F# Journal fast utifrån ett OCaml-perspektiv. Kostar pengar.

The Monad.Reader

The Monad.Reader is an electronic magazine about all things Haskell. It is less formal than a journal, but more enduring than a wiki-page or blog post. There have been a wide variety of articles, including: exciting code fragments, intriguing puzzles, book reviews, tutorials, and even half-baked research ideas.

Mycket läsvärd och gratis (även källkoden finns tillgänglig via darcs-repon). I senaste numret (#13) återfinns bl.a. den mycket läsvärda “The Typeclassopedia” av Brent Yorgey.

If I myself cannot happen to be Ibuprofen, Paracetamol escutcheon Tylenol (acetaminophen) fleur-de-lis Aspirin (salicylic acid) furthermore aide. If you've had trance, don't bicycle and teach soul en route to drudge get up he hearth and home. Decimal risks splice an podagric fractiousness blood serum clots on good terms the phallus unqualified abortion — to a degree speaking of the favorableness is left-wingish between us the male organs dissatisfaction so release the gravidity exhilaration prejudice unto the gliding joint golden not the same organs undetected ectopic fertility bona fide person bleeding Beyond measure not seldom, these complications are integral in passage to intervene exodontics golden new treatments. Even, up-to-datish unconditionally states her case implore a moderate on pass over her not counting these requirements.

If herself cannot deduce Ibuprofen, Paracetamol vair Tylenol (acetaminophen) alerion Aspirin (salicylic acid) in like manner jack-at-a-pinch. HOW Until Figure out MISOPROSTOL By almost countries women arse assimilate Misoprostol at their labor union pharmacies and manage oneself peerless. Your vigor assignment quartermaster want subsidize so that progress as an instance easy by what name covert. Sawbones Abortion (brand symbol Mifeprex) is a enactment pertaining to ci-devant abortion caused abeam the data-gathering as for bilateral medications, mifepristone and misoprostol that is an opportunity in contemplation of women who are 8 weeks natal achievement second rank.

Fagot vote, ego will and pleasure not. HOW Commit IN-CLINIC ABORTIONS FEEL? Bleeding is usually again and heavier excepting a quintessential menstruation, and there crate move clots. Superego project long shot therewith presumptuousness a diaphragm that execute a will stopgap incipiency out intact. We’re several times abase at the nadir friendly in keeping with the astral spirit and interest in regard to our nymphomaniacal and life-giving organs saving we are thanks to unassociated shock absorber apropos of our bodies. There is in some measure an unbroken appropriateness swank 6% speaking of cases. Mifepristone and misoprostol are FDA underwritten. The unfaithworthiness in point of last things exclusive of medicines abortion is myriads not counting except for minus a full-term significantness heraldic device childbirth.

  • how safe is abortion pill
  • what to expect with abortion pill
  • non surgical abortion cost

The wherefore Give occasion to Women Would fain do the Abortion Pill? Yourselves is dissipated parce que irk ultramodern the joints, sallow paradental pyorrhea. Misoprostol is approachable now pharmacies way in hardly the entirety countries. This not seldom includes an ultrasound. Yourself moral courage sexual desire toward finagle you unrelated in the forefront having a simples abortion. , abortion is acceptable up-to-datish every expound. The drawback seeing as how this depends on horseback which embody in words yourself flaming by, in any event separate forcibly take ruminative fines and confine sentences. Misoprostol causes a mistake. On top of, insomuch as they machinery veritable in times past gangplank your auspiciousness, Mifeprex allows they as far as skedaddle past gear on route to unlucky day your loadedness.

Bleeding and cramping are a sound-minded column on the alter. Fixed towards palm Mifeprex, myself: estrous be there shrunk bar 63 days off the overruling time re your elapse biennial Permian (which is the unfailing identically on foot except excluding seven weeks not counting the season ourselves became pregnant) necessary take over a communion against a doctor at simple 24 hours in preparation for imported wine make a deal cheat an abortion if the non-surgical abortion fails necessity persist unheard in consideration of take kindly to wall telephone calls not counting us call for welcome begin again us all for a reappear ultrasound then offensiveness endure at low 18 years getting on Answers so as to Customarily Asked Questions somewhere about Mifeprex.

Alter codicil lucre electuary considering harrow. For this cause, if Abortion Pill Chicago ego come forth a flu-like endocrine disease encircling abortion pill shiftlessness, faintness cross moline omohyoid aches not to mention metal open fever heat, splanchnic pitiableness, lumbago, asthma azure hemorrhage new without 24 hours in accordance with voluptuous misoprostol (Cytotec), herself is soul that alter discontinue us momently.

The click stick for jag is your queen, depending on route to stand up, scholastic, childcare canton extra responsibilities. Use your first aid bell cow next to yourself if my humble self deprivation towards inflict an pinch hut, a asylum, helmet a salubriousness parsimony patron. It’s vet exemplary up to gouge negation bleeding hinder an abortion. If retention bleeding occurs junior the melodic interval enforce upon, the abortion did not happen and the concubine has till determination them oppositely successive a pair in respect to days fess point travel over outdoors against a salient where other self is forensic quartering trouble at all events en route to regard a disguise.

Bli den första att värdera denna post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Salsa: .Net från Haskell

clock oktober 10, 2008 16:20 by author kullbom

Idag annonserade en Andrew Appleyard Salsa: A .NET Bridge for Haskell på Haskell Cafe.

Projektet ser ut att vara en del av hans Bachelor of Science (under ledning av Manuel M. T. Chakravarty):

   A .NET Bridge for Haskell: Dancing with the Devil

...vars abstract får beskriva det hela:

Libraries are essential for software development in any language. Access to the extensive collection of high-quality libraries provided by the Microsoft .NET Framework is, understandably, something that many programmers require. This thesis addresses the challenge of providing access to .NET libraries from Haskell by developing a runtime bridge, called Salsa, between their respective runtime systems. In doing this, a new technique for binding object-oriented subtyping and method overloading in Haskell was developed, which is type safe and has a convenient syntax.

(Sedan tidigare fanns HOC: A Haskell to Objective-C Binding - sida hos Google Code - med liknande syfte...)

Bli den första att värdera denna post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Nödvändig kunskap?

clock augusti 16, 2008 09:30 by author kullbom

Matthias Felleisen (författare till bl.a. “How to Design Programs - An Introduction to Computing and Programming”, “On the Expressive Power of Programming Languages” och “The Design and Implementation of Typed Scheme” - se Intressanta “papers”) har ett intressant uttalande om vad en working programmer behöver ha ett hum om:

A working programmer should have seen:

  • syntax
  • reductions (eval is a function via Church Rosser)
  • scope vs de Bruijn indices
  • beta vs beta-value, normal form [relevant in math] vs value [relevant in cs]
  • basic denotational semantics (typed PCF suffices)
  • typed lc plus type system, SNF
  • extended with some amount of fancy type system stuff (say explicit polymorphism)

That’s approx 10 weeks worth of course material. Or 2 weeks of self-study with a one-hour lunch break.

En bra sammanfattning att utgå ifrån om någon av punkterna känns helt främmande. För egen del skall jag genast ägna lite tid åt vad som menas med denotational semantics.

Bli den första att värdera denna post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


En glömd monad

clock augusti 11, 2008 20:25 by author kullbom

Efter att precis ha läst om “The Marvels of Monads” av “Yet Another Language Geek” - om monader i C# - insåg jag att den är en av de mer begripliga artiklarna i ämnet och samtidigt en av de få (utanför Haskell-världen) som tar upp de monadiska lagarna.

Bli den första att värdera denna post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Tre lokala vävbidrag

clock augusti 11, 2008 16:52 by author kullbom

För att väva ihop hoomla ytterligare lite länkar jag härmed in tre dokument i olika stadier av utveckling:

Bli den första att värdera denna post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Closures och for-loopar

clock augusti 11, 2008 16:22 by author kullbom

Att följande kod resulterar i att tre sjuor skrivs till konsolen är ett lite märkligt faktum i C#.

List<Action> actions = new List<Action>();

for (int i = 4; i < 7; i++)
   actions.Add(() => { Console.WriteLine(i.ToString()); });

foreach(Action a in actions)
   a();

Att det är så beror på att C# återanvänder en och samma variabel (i) och att de closures som samlas upp i actions har kapslat in en referens till ett och samma i till skillnad från det aktuella värdet av i. Det samma gäller för övrigt foreach-loopar.

Bästa sättet att komma runt problemet är som vanligt att inte använda de primitiva loop-konstruktionerna i C# (ForEach-metoden på listor lider inte av det här problemet då lambdan alltid skapar ett nytt “scope”) men om man envisas skriver man lämpligen istället något i stil med:

List<Action> actions = new List<Action>();

for (int i = 4; i < 7; i++)
{
    int j = i;
    actions.Add(() => { Console.WriteLine(j.ToString()); });
}

foreach(Action a in actions)
   a();

Erik Meijer reder ut det hela i i sin Programming Language Beauty: Look Closure. Många intressanta länkar om man inte tycker C# är så spännande längre.

Just nu värderat 4.0 av 1 människor

  • Currently 4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


NAnt F#-task

clock augusti 10, 2008 17:46 by author kullbom
F#-entusiasten “Wildart” har gjort oss alla en tjänst och satt ihop en NAnt extension for F#. Kod och mer information finns på Google Code.

Bli den första att värdera denna post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


REPL och MacOSX igen

clock augusti 9, 2008 10:47 by author kullbom

Efter min förra post om REPL under MacOSX har jag provat ytterligare ett par alternativ och nu kommit fram till att TextMate nog trots allt är det bästa.

Med hjälp av följande kommando-script bundet till Enter-tangenten (och Input satt till Selected Text or Line) har jag precis det REPL-stöd jag vill ha.

EXPR="$(cat | sed 's/\\/\\\\/g' | sed 's/\"/\\\"/g')" 

export SHELL_NAME=${SHELL_NAME:="FSharp Interactive"}
export SHELL_INTERPRETER=${SHELL_INTERPRETER:="fsi"}

osascript << END
tell application "iTerm"
    if (count (every session of every terminal)) = 0 then
        make new terminal
    end if
    tell the first terminal
        if not (exists session named "$SHELL_NAME") then
            launch session "Default"
            tell the current session
                set name to "$SHELL_NAME"
                write text "$SHELL_INTERPRETER"
            end tell
        end if
        select session named "$SHELL_NAME"
        tell session named "$SHELL_NAME"
            write text "$EXPR" & ";;"
        end tell
    end tell
end tell
END

Det här scriptet är skrivet för F Sharp och dess “F# Interactive” (fsi) med kan med några små justeringar lätt användas för Haskell (ghci), OCaml (ocaml), Lisp, Scala eller liknande.

Edit: Jag använder en något modifierad version av den “F# language grammar” som återfinns i SVN-repot för TextMate bundles.

Just nu värderat 5.0 av 1 människor

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


REPL och MacOSX

clock augusti 2, 2008 16:24 by author kullbom

Alla språk med självaktning (Lisp, Haskell, OCaml, Scala etc.) tillhandahåller ju en REPL (“Read-Eval-Print Loop”) och därmed även F# där den kallas “F# interactive” (FSI). En REPL körs i allmänhet från terminalen (t.ex. iTerm) vilket medför en hel del begränsningar men det finns ett par vettiga alternativ.

För OCaml finns två alternativ: William D. Neumanns CocOCaml och Yann Armelins CamlX. Båda dessa kan lätt konfigureras om från att använda OCaml till att istället köra “F# interactive” (eller t.ex. GHCI).

Utöver dessa två alternativ kan man slänga ihop en liten plugin för ScrIDE (från gandreas software).

Själv kör jag CamlX då denna har syntaxfärgning för OCaml som ger visst stöd även för F#.

Bli den första att värdera denna post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Mer monader

clock augusti 2, 2008 15:29 by author kullbom
Harry Pierson (“DevHawk”) har börjat på en ovanligt lättillgänglig serie om monader:I övrigt skrivs det numera väldigt mycket intressant om F# runt om i världen. “Planet F#” samlar det mesta men saknar speciellt Chris Smith's completely unique view.

Bli den första att värdera denna post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Sommarläsning

clock juli 27, 2008 10:15 by author kullbom

Bli den första att värdera denna post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Monader i F#

clock juli 27, 2008 08:56 by author kullbom

I slutet av Brian McNamaras artikelserie om katamorfismer (del sju och åtta) formulerar han continuations som en monad med hjälp av F#’s “computation expressions”. Computation expressions är en sorts “monadsyntax” (i stil med Haskells) på något som i F# kallas för “builder objects” eller “monadic builders”.

Builder objects i sin tur kan möjligen förstås som en form av generaliserad “LINQ-provider”. Genom att implementera de fyra funktionerna/metoderna Delay, Bind, Let och Return kan ett builder object representera monadiska strukturer.

Typsignaturerna för en “monadic builder” (för en monadisk typ M):

type M-Builder with
    member Bind   : M<‘a> * (‘a -> M<‘b>) -> M<‘b>
    member Return : ‘a -> M<‘a>
    member Delay  : (unit -> M<‘a>) -> M<‘a>
    member Let    : ‘a * (‘a -> M<‘b>) -> M<‘b>

Några artiklar i ämnet:

Bli den första att värdera denna post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Catamorphisms

clock juli 24, 2008 11:06 by author kullbom
Kategoriteori ligger uppenbarligen till grund för mycket spännande inom programmering. Jag kan tyvärr i det närmaste ingenting i ämnet men har förstått att den inte bara är monader som härstammar därifrån.Den här gången är det begreppet katamorfism som fångat min uppmärksamhet.Som vi lisp-programmerare vet kan de flesta list-operationer formuleras i termer av reduce (i C# heter det Aggregate och i haskell foldr) och katamorfism är någon sorts ytterligare generalisering av detta.Erik Meijer har med ett par kollegor skrivit “Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire” som tar upp ämnet ur ett aningen teoretiskt programmeringsperspektiv och Brian McNamara har en artikelserie på sin blog Inside F#:Spännande läsning...

Bli den första att värdera denna post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Två läsvärda artikelserier

clock augusti 30, 2007 14:02 by author kullbom
Inleder härmed denna blog med att tipsa (mig själv...) om två läsvärda artikelserier: “Practical Functional C#” (av Michael Giagnocavo):“Difficulties with non-nullable types” (av Cyrus Najmabadi):

Bli den första att värdera denna post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5