Avoiding stack overflow (with F# infinite sequences of sequences)

You should definitely check out http://research.microsoft.com/en-us/um/cambridge/projects/fsharp/manual/FSharp.PowerPack/Microsoft.FSharp.Collections.LazyList.html but I will try to post a more comprehensive answer later. UPDATE Ok, a solution is below. It represents the Morris sequence as a LazyList of LazyLists of int, since I presume you want it to be lazy in ‘both directions’. The F# LazyList (in the FSharp.PowerPack.dll) has three … Read more

Is Clojure object-oriented at its heart? (Polymorphism in seqs)

Idiomatic Clojure favors defining independent functions that operate on a very small set of core data structures; this unbundling of methods and data is a strong statement against object orientation and in favour of a functional style. Rich Hickey (creator of Clojure) has repeatedly stated the importance of this; for example here: “Clojure eschews the … Read more

Programmatic access to On-Line Encyclopedia of Integer Sequences

The OEIS now provides several points of access, not just ones using their internal format. These seem largely undocumented, so here are all of the endpoints that I have found: https://oeis.org/search?fmt=json&q=<sequenceTerm>&start=<itemToStartAt> Returns a JSON formatted response of the results found from the sequenceTerm given. If too many results were returned, count will be > 0 … Read more

How would you implement sequences in Microsoft SQL Server?

Sql Server 2012 has introduced SEQUENCE objects, which allow you to generate sequential numeric values not associated with any table. Creating them are easy: CREATE SEQUENCE Schema.SequenceName AS int INCREMENT BY 1 ; An example of using them before insertion: DECLARE @NextID int ; SET @NextID = NEXT VALUE FOR Schema.SequenceName; — Some work happens … Read more

Sequence contains no elements exception in linq without even using Single

As Dennis Traub has pointed out, the overload of Aggregate you are using throws that exception when the source sequence is empty. The obvious fix is to use the other overload of Aggregate that accepts an initial seed (you want string.Empty), but that would result in a leading comma in the result which you’ll have … Read more

tech