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 5971099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:28:10+00:00 2026-05-22T20:28:10+00:00

Related: Lazy datatypes in Objective C From the related question I was able to

  • 0

Related:
Lazy datatypes in Objective C

From the related question I was able to figure out how to use block objects to mimic suspended computation, but I am still trying to grasp the concept. For a horribleComputation it would work, but how would one model an infinite stream ?

How it is normally done in SML,

(* Have a datatype to wrap a computation *)
datatype 'a susp = Susp of (unit -> 'a)

(* Create a recursive datatype to handle an infinite stream  *)
datatype 'a stream = Cons of 'a * ('a stream') susp
type 'a stream = ('a stream') susp

Now in Objective-C there is typedef which takes predefined values

enum suit {hearts, spades, diamonds, clubs};

I just cannot figure out how to get the Cons of part

For now, if infinite data modelling is not possible, how would one model for example a Hand of cards. Again in SML,

datatype suit = Clubs | Spades | Hearts | Diamonds
datatype rank = Two | Four | Five (*... etc *)

(* Then a card *)
type card = rank*suit

(* And now we can have a Hand :) *)
datatype hand = Empty | Hand of card * hand;

Most likely everything is not transferable, but I am just curious how well I can use Objective C for lazy programming … such as processing all natural numbers on demand. I have been making circles with my search for this.

  • 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-22T20:28:10+00:00Added an answer on May 22, 2026 at 8:28 pm

    There are two separate, orthogonal concepts: recursive datatypes and lazy computations. In C and C-like languages, you model the former with a struct that contains pointer(s) to either itself, or to other data type that contains/points to that struct directly or indirectly. Use block objects or whatever to suspend your computations. Combine the two concepts together and get a struct that contains a pointer to a suspended computation that returns (a pointer to) that struct.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I persist a question instance, the answer objects related to that question does
Related to an earlier question I asked, I've seen that there's both LoadComponent() and
Related: How can I use polymorphism in XML Serialization? I have a class I
Related to my question here but not enough to open a new question. I
Related question [stackoverflow] here . I'm trying to do the above, but I want
Related to a question I asked earlier here , I've found a problem which
Related to this question , is the idea of a default servlet that serves
Related to my previous question , I have a string on the following format:
Related to my other question , I have now modified the sparse matrix solver
(this is related to another question about implementation on iPhone) I have a large

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.