Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6989713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:14:59+00:00 2026-05-27T19:14:59+00:00

I am learning RX (Reactive Extensions), I tried to use some code samples from

  • 0

I am learning RX (Reactive Extensions), I tried to use some code samples from internet, the source code was in C#:

var input = Observable.Range(1, 100); 
input.Sum().Subscribe(x => Console.WriteLine("The Sum is {0}", x)); 

Since I don’t really “SPEAK” C#, so I want to use F# to do the same thing.
I download RX, and create a F# windows application, add reference to System.Reactive. My IDE is VS 2010 Ultimate, RX version is: 1.1.11111
Here is my code:

#light
open System
open System.Collections.Generic
open System.ComponentModel
open System.Linq
open System.Text
open System.Reactive
open System.Reactive.Linq

let input = Observable.Range(1, 100)
let x = input.Sum().Subscribe()
printfn "%A" x

The result should be 5050, as the sum of 1 to 100 is 5050. However, I can see only this:
System.Reactive.AutoDetachObserver`1[System.Int32]

Please let me know how I can see the result for 5050.
I hope the C# code will work in F# too. If not, please let me know what I can do.
Thanks and Happy New Year to you all!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T19:15:00+00:00Added an answer on May 27, 2026 at 7:15 pm

    The Subscribe method takes a function as its argument (x => foo is an anonymous function (lambda expression) in C#). So you should also call it with a function as its argument:

    let input = Observable.Range(1, 100)
    input.Sum().Subscribe(fun x -> printfn "%A" x)
    

    Or

    let input = Observable.Range(1, 100)
    input.Sum().Subscribe(printfn "%A")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am learning RX (Reactive Extensions), and have found someone posted some code nearly
I am slowly learning how to use Reactive Extensions for .NET with WPF. There
I'm learning Reactive Extensions, and I've been trying to find out if it's a
Learning to use Ruby Threads for transportability of code between different OS platforms. The
Learning my way through this stuff and could use some help. I'm trying to
Learning client side code of an existing site, would like to understand some activity
I'm learning reactive-banana and intending to use it in a server-side app. I have
I am learning RX, and trying to port some code in C# to F#.
Learning from my last question , most member names seem to get included in
Learning Scala currently and needed to invert a Map to do some inverted value->key

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.