29 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
1
vote
2
answers
2k
views
In Elixir, how do I remove ALL whitespace from a string?
I want to remove ALL whitespace from a string, that is, if I have:
rna= "AUG UUU UCU" Then I'd like to have: new_rna="AUGUUUUCU"
How do I do that in Elixir?`
I looked up way of ...
13
votes
2
answers
353
views
When does it make sense to use a sigil-less variable in Raku?
Raku sigils denote the nature of the underlying variable (e.g., $scalar, @positional, %associative, &code).
It's possible to declare a variable as sigil-less with a backslash (e.g., \some-variable)...
2
votes
1
answer
141
views
what's meaning of `~w(username full_name password)a`?
In hexpm project, The line cast(%User{}, params, ~w(username full_name password)a).
I know it may be equal to [:username, :full_name,:password], but why?
What's the meaning of ~w and a?
def build(...
1
vote
2
answers
982
views
How to replace deprecated ~E sigil with ~H in Phoenix render funciton
Background
In my quest to learn Phoenix LiveView I found myself using a render function that uses a deprecated sigil:
def render(_assigns) do
~E"""
<menubar>
<...
1
vote
1
answer
1k
views
Sigil editor: Regex string to look for a (hyphen) character in text, but not html attributes
My problem:
I use Sigil to edit xhtml files of an ebook.
When exporting from InDesign to ePub I tick option to remove forced line breaks.
This act removes all - hyphen characters which are auto-...
Peter's user avatar
- 2,729
15
votes
2
answers
784
views
What's the benefit of assigning non-scalars to scalars?
I sometimes see code that (to me) uses the wrong sigil in front of the variable
my $arr = [1, 2, 3, 4, 5]; # an array
my $lst = (1, 2, 3, 4, 5); # a list
my $hash = {a => '1', b => '...
0
votes
1
answer
835
views
Backporting Sigils and make it work with variables
So I'm just starting out in Elixir and saw that the current master adds support for a ~U[2015年01月13日 13:00:07Z] sigil to create/parse UTC date.
Code follows:
defmodule MySigils do
defmacro sigil_U(...
-3
votes
1
answer
243
views
What is the benefit of Sigils in Perl? [closed]
I understand the rules with sigils. I can make hashes from lists, and pass refs around with the mediocre-ist of them. What I don't understand are the benefits sigils provide in Perl.
Some of the ...
4
votes
1
answer
153
views
perl 6 variable same name different sigils inconsistent behavior
There seems to be some inconsistent behavior when variables of the same letter-name but different sigils are used:
> my $a="foo";
foo
> my @a=1,2
[1 2]
> say $a
foo # this is ...
7
votes
1
answer
410
views
What is @$ in perl?
I came across this, expecting it to be a typo for $@:
use strict;
use warnings;
eval {
my $error = Not::Here->new();
};
warn @$;
And to my surprise it outputs this:
Can't locate object ...
1
vote
2
answers
783
views
Escape closed parenthesis in elixir sigil
I want to have a custom sigil, so that i can have one element per line.
This is code i have
def sigil_l(text,[]), do: String.split(text,"\n")
This works fine for
~l(Clash of Titans
The day after ...
0
votes
2
answers
285
views
Join Broken Paragraphs HTMl Regex
I'm trying to edit some xhtml on Sigil.
With the command
< p>([a-z])
I'm able to find all paragraphs that begin with lower case. That tells me that they shouldn't be separate from the previous ...
1
vote
2
answers
475
views
Why the syntax for defining sigils in Elixir doesn't use "defsigil"?
I was reading the page about sigils in the Elixir tutorial.
I expected the syntax for defining sigils uses "defsigil" just like "defstruct", "defprotocol", and so on.
But it was not so.
Why?
1
vote
2
answers
72
views
Why I can use @list to call an array, but can't use %dict to call a hash in perl? [duplicate]
Today I start my perl journey, and now I'm exploring the data type.
My code looks like:
@list=(1,2,3,4,5);
%dict=(1,2,3,4,5);
print "$list[0]\n"; # using [ ] to wrap index
print "$dict{1}\n"...
3
votes
1
answer
161
views
What does this mean "jQuery(function ($) {})"? [duplicate]
What does the below line mean? It passes function($) as a parameter into jQuery?
jQuery(function ($) {
// ...
});