seq Questions

4

Solved

var seq = Seq[String]() seq = seq :+ "hello" var set = Set[String]() set += "hello" what's the difference between Seq and Set?
Drowsy asked 6/11, 2013 at 2:48

1

Solved

I have noticed a strange seq behavior on one of my computers (Ubuntu LTS 14.04): instead of using points as decimal separator it is using commas: seq 0. 0.1 0.2 0,0 0,1 0,2 The same version of s...
Roadstead asked 27/5, 2014 at 8:50

2

Solved

I am new to shell scripting and I am trying a simple task of getting the length of a sequence of numbers generated using seq. With the help of a related post here: How to find the array length in ...
Mame asked 5/5, 2014 at 13:11

1

Solved

So I've made some utility classes and implicit conversions for them. However, it works fine when converting from a Seq but not from a Set, although the code is the same, and those two traits seem r...
Castano asked 24/4, 2014 at 16:0

4

Solved

Every collection in clojure is said to be "sequable" but only list and cons are actually seqs: user> (seq? {:a 1 :b 2}) false user> (seq? [1 2 3]) false All other seq functions first conv...
Susie asked 21/4, 2014 at 0:15

3

Solved

What's the differences between seqs and lists in Clojure language? (list [1 2 3]) => ([1 2 3]) (seq [1 2 3]) => ([1 2 3]) These two forms seem to be evaluated as the same results.
Teddytedeschi asked 14/3, 2014 at 21:51

2

Solved

Is there a more idiomatic way to change a nested sequence of sequences into a nested set of sets? def toNestedSet[T](tsss: Seq[Seq[Seq[T]]]): Set[Set[Set[T]]] = tsss.map(_.map(_.toSet).toSet).to...
Dentoid asked 11/2, 2014 at 14:52

2

Solved

I am new to haskell, and have just come to the lazy world proramming. I read that the seq function is very special because it forces to use a strict evaluation in order to be more efficient in some...
Wentworth asked 9/1, 2014 at 8:45

1

Solved

Whilst solving the 12th project euler problem I set about making an infinite sequence to get successive triangular numbers. My first attempt was: let slowTriangularNumbers = let rec triangularNu...
Trifoliate asked 27/12, 2013 at 18:18

2

Solved

Given this code snippet: someFunction x = print x `seq` 1 main = do print (someFunction "test") why doesn't the print x print test when the code is executed? $./seq_test 1 If I replace it ...
Coelacanth asked 2/12, 2013 at 9:7

4

Solved

Basically I want to generate a sequence, say: n is 2, the sequence will be 112 n is 3, sequence is 112123 n is 5, sequence is 112123123412345 I did come up with a solution n=5 seq=1 for (i in 2...
Surfing asked 11/10, 2013 at 11:33

3

Solved

I'm trying to print the following pattern using printf and seq: 0000 0001 0002 0003 My problem is once I use: seq 0 10 | xargs printf %04d all my output is formatted into the same line likeso...
Aristate asked 2/10, 2013 at 23:20

4

Solved

I'm using the Sesame library to run SPARQL queries over an in-memory triple store. I am using Clojure to achieve this. A query result is a custom Iterator-like [1] object, so the clojure seq does...
Dewar asked 10/2, 2012 at 10:0

5

Solved

I think I do not quite understand how F# infers types in sequence expressions and why types are not correctly recognized even if I specify the type of the elements directly from "seq". In the foll...
Chacon asked 23/5, 2013 at 12:57

1

Solved

As shown in this answer, seq combined with undefined does very strange things when it comes to equational reasoning, for example it can make any monad fail. Another example is in this question. Re...
Burnett asked 7/12, 2012 at 21:35

2

Solved

What are good examples of when seq_along will work, but seq will produce unintended results? From the documentation of ?seq we have: Note that it dispatches on the class of the first argument ...
Project asked 5/12, 2012 at 20:43

2

Solved

I wrote a method that accepts objects of all subclasses of Seq[String]. Unfortunately it won't accept an object of the type Array[String]. Is Array[String] not a subclass of Seq[String]? scala>...
Sudan asked 17/7, 2012 at 12:59

3

Solved

I am working in clojure with a java class which provides a retrieval API for a domain specific binary file holding a series of records. The java class is initialized with a file and then provides...
Airline asked 10/7, 2012 at 13:9

1

The page Foldr Foldl Foldl' discusses foldl', and defines it like: foldl' f z [] = z foldl' f z (x:xs) = let z' = z `f` x in seq z' $ foldl' f z' xs This is done to avoid space leaks, i.e. so ...
Shingly asked 19/6, 2012 at 3:15

2

Solved

I'm new to Clojure and I was wondering if there's a way to create a sequence of maps from two or more sequences. Let's say you have: (def numbers '(1 2 3)) (def letters '("a" "b" "c")) (def shape...
Oakie asked 10/6, 2012 at 8:0

1

Solved

Consider this code in F#: let n = 10000000 let arr = Array.init n (fun _ -> 0) let rec buildList n acc i = if i = n then acc else buildList n (0::acc) (i + 1) let lst = buildList n [] 0 let d...
Snotty asked 3/6, 2012 at 22:47

2

Solved

Lets say I have the following: f :: a -> b -> c g :: b -> c g = f 10 Now lets say f is actually: f x y = f1 x + y Would: g `seq` ... actually evaluate f1 10, so later when running...
Murton asked 16/4, 2012 at 7:51

5

Solved

This FAQ says that The seq operator is seq :: a -> b -> b x seq y will evaluate x, enough to check that it is not bottom, then discard the result and evaluate y. This might not seem ...
Aristotelianism asked 14/3, 2012 at 17:44

1

Solved

Say, I have a sequence of strings as an input and I want to get a new immutable Seq which consists of elements of the input and an item "c". Here are two methods that I've discovered to be working:...
Collywobbles asked 28/11, 2011 at 12:9

2

Is there any concise way to convert a Seq into ArrayBuffer in Scala?
Dovev asked 26/9, 2011 at 9:40

© 2022 - 2024 — McMap. All rights reserved.