Questions tagged [reverse]

Rearranging the order of a sequence such that the final order is a mirror image of the original.

Rearranging the order of a sequence such that the final order is a mirror image of the original.

3773 questions
22
votes
11 answers

Value of the last element of a list

how to get the value of the last element of a List? I've noted that List.hd (or .Head) return an item, while List.tl (or .Tail) returns a List. Is rev the List and get the hd the only way around? Thanks.
pistacchio
  • 56,889
  • 107
  • 278
  • 420
22
votes
10 answers

How can I get the reverse url for a Django Flatpages template

How can I get the reverse url for a Django Flatpages template
Travis
  • 245
  • 1
  • 3
  • 8
21
votes
8 answers

Reverse Array Order

I am trying to reverse the order of an Array in java. What is the most efficient way to do so in O(n) with the least amount of memory used. No need to answer with code, pseudo code will be fine. Here is my thought process: create a new temp array…
marcoo
  • 821
  • 1
  • 9
  • 25
21
votes
2 answers

How to iterate Lua table from end?

How do I iterate a simple Lua table, that is a sequence, from end? Example of wanted behavior: local mytable = {'a', 'b', 'c'} for i, value in reversedipairs(mytable) do print(i .. ": " .. value) end should output 3: c 2: b 1: a How to…
Franz Wexler
  • 1,112
  • 2
  • 9
  • 15
21
votes
6 answers

Array Reverse is not working for me ...

Consider the following code (React JS code): poll() { var self = this; var url = "//" + location.hostname + "/api/v1/eve/history/historical-data/" + this.state.itemId + '/' + this.state.regionId + '/40'; $.get(url,…
TheWebs
  • 12,470
  • 30
  • 107
  • 211
21
votes
7 answers

Reverse a Python string without omitting start and end slice

How do you reverse a Python string without omitting the start and end slice arguments? word = "hello" reversed_word = word[::-1] I understand that this works, but how would I get the result by specifying the start and end indexes? word =…
Ogen
  • 6,499
  • 7
  • 58
  • 124
21
votes
4 answers

reversing z-index based from page render order

Example Markup:

Trigger

This is some content

Trigger

This is some content

Trigger

This is…
DA.
  • 39,848
  • 49
  • 150
  • 213
20
votes
5 answers

How to generate random strings that match a given regexp?

Duplicate: Random string that matches a regexp No, it isn't. I'm looking for an easy and universal method, one that I could actually implement. That's far more difficult than randomly generating passwords. I want to create an application that…
Michał Tatarynowicz
  • 1,294
  • 2
  • 15
  • 33
20
votes
2 answers

nginx server_name inside stream block possible?

Current setup as follows: stream { server { listen 9987 udp; server_name subdomain.EXAMPLE.com; # this line is resulting in an error proxy_pass localhost:9987; proxy_timeout 1s; proxy_responses 1; …
Emmmm
  • 469
  • 1
  • 4
  • 8
20
votes
2 answers

Reversing default scale gradient ggplot2

I am newbie, I am trying to desing a heat map. This is my code: ggplot(gd, aes(Qcountry, Q6_1_Q6d), order = TRUE) + geom_tile(aes(fill = prob), colour = "white") + theme_minimal() + labs( y = "Main reason for mobility", x = "Country") + …
Tito Sanz
  • 1,280
  • 1
  • 16
  • 33
20
votes
2 answers

RecyclerView scrolling on insert

I am trying to use RecyclerView to create a chat application. I am using a LinearLayoutManager with setReverseLayout(true). When I am scrolled all the way to the bottom (which is the dataset start = newest message) and a new message is inserted…
ehehhh
  • 1,066
  • 3
  • 16
  • 27
20
votes
9 answers

Reverse elements via pipeline

Is there a function that reverses elements passed via pipeline? E.g.: PS C:\> 10, 20, 30 | Reverse 30 20 10
dharmatech
  • 8,979
  • 8
  • 42
  • 88
20
votes
4 answers

list.reverse() is not working

I honestly just don't understand why this is returning None rather than a reversed list: >>> l = range(10) >>> print l [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> print l.reverse() None Why is this happening? According to the docs, I am doing nothing…
Ryan Saxe
  • 17,123
  • 23
  • 80
  • 128
19
votes
4 answers

glob() — Sort by Name

How can I reverse the sort by filename? Currently it displays all the text files in alphabetical / numerical order, but I'm trying to have it display in descending order instead. Right now, I have...
FrozenTime
  • 231
  • 1
  • 2
  • 9
18
votes
1 answer

Is it possible to run a neural network in reverse?

If we have a neural network such as the multilayer perceptron back propagation neural network that uses sigmodial logistic activation functions is it possible to feed the network outputs and have it compute back a set of inputs? Since we can reverse…
A Person
  • 801
  • 1
  • 10
  • 22