Meaning of a semicolon in lambda expressionWhat does “static” mean in C?Retrieving Property name from lambda expressionWhy would you use Expression<Func<T>> rather than Func<T>?Why are Python lambdas useful?Distinct() with lambda?What does “use strict” do in JavaScript, and what is the reasoning behind it?What does the star operator mean?Why does ++[[]][+[]]+[+[]] return the string “10”?How can a time function exist in functional programming?What is a lambda expression in C++11?
Formal mathematical definition of renormalization group flow
Variable doesn't parse as string
The Game of the Century - why didn't Byrne take the rook after he forked Fischer?
Is there a way to improve my grade after graduation?
Single flight multiple flight numbers?
Is there a booking app or site that lets you specify your gender for shared dormitories?
If someone else uploads my GPL'd code to Github without my permission, is that a copyright violation?
How do I know when and if a character requires a backstory?
When using the Proficiency Dice optional rule, how should they be used in determining a character's Spell Save DC?
What's "halachic" about "Esav hates Ya'akov"?
Is it okay to use different fingers every time while playing a song on keyboard? Is it considered a bad practice?
How easy is it to get a gun illegally in the United States?
what can you do with Format View
Why do rocket engines use nitrogen actuators to operate the fuel/oxidiser valves instead of electric servos?
Is a switch from R to Python worth it?
Why is the Vasa Museum in Stockholm so Popular?
How to design an effective polearm-bow hybrid?
Awk to get all my regular users in shadow
Is an "are" omitted in this sentence
Is there a way to say "double + any number" in German?
Why is it to say 'paucis post diebus'?
Write The Shortest Program To Check If A Binary Tree Is Balanced
How to win against ants
Would this winged human/angel be able to fly?
Meaning of a semicolon in lambda expression
What does “static” mean in C?Retrieving Property name from lambda expressionWhy would you use Expression<Func<T>> rather than Func<T>?Why are Python lambdas useful?Distinct() with lambda?What does “use strict” do in JavaScript, and what is the reasoning behind it?What does the star operator mean?Why does ++[[]][+[]]+[+[]] return the string “10”?How can a time function exist in functional programming?What is a lambda expression in C++11?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Type:
data Command a = Command String (a -> IO a)
Function:
iofunc_ :: String -> (a -> IO ()) -> Command a
iofunc_ s f = Command s (x -> do f x ; return x)
What does the semicolon do in the lambda expression (x -> do f x ; return x)
?
haskell lambda syntax
add a comment |
Type:
data Command a = Command String (a -> IO a)
Function:
iofunc_ :: String -> (a -> IO ()) -> Command a
iofunc_ s f = Command s (x -> do f x ; return x)
What does the semicolon do in the lambda expression (x -> do f x ; return x)
?
haskell lambda syntax
3
It's part of thedo
-notation, not the lambda.
– augustss
Dec 25 '14 at 12:08
add a comment |
Type:
data Command a = Command String (a -> IO a)
Function:
iofunc_ :: String -> (a -> IO ()) -> Command a
iofunc_ s f = Command s (x -> do f x ; return x)
What does the semicolon do in the lambda expression (x -> do f x ; return x)
?
haskell lambda syntax
Type:
data Command a = Command String (a -> IO a)
Function:
iofunc_ :: String -> (a -> IO ()) -> Command a
iofunc_ s f = Command s (x -> do f x ; return x)
What does the semicolon do in the lambda expression (x -> do f x ; return x)
?
haskell lambda syntax
haskell lambda syntax
edited Mar 27 at 5:21
dfeuer
35.2k3 gold badges52 silver badges137 bronze badges
35.2k3 gold badges52 silver badges137 bronze badges
asked Dec 25 '14 at 11:54
StankoStanko
1,4402 gold badges11 silver badges37 bronze badges
1,4402 gold badges11 silver badges37 bronze badges
3
It's part of thedo
-notation, not the lambda.
– augustss
Dec 25 '14 at 12:08
add a comment |
3
It's part of thedo
-notation, not the lambda.
– augustss
Dec 25 '14 at 12:08
3
3
It's part of the
do
-notation, not the lambda.– augustss
Dec 25 '14 at 12:08
It's part of the
do
-notation, not the lambda.– augustss
Dec 25 '14 at 12:08
add a comment |
2 Answers
2
active
oldest
votes
They just separate the two expression f x
and return x
in do notation. In fact these all are equivalent in your case:
iofunc_ s f = Command s (x -> do f x ; return x)
iofunc_ s f = Command s (x -> do f x ; return x)
iofunc_ s f = Command s (x -> do f x
return x)
iofunc_ s f = Command s (x -> f x >> return x)
1
When can you omit the curly braces? I always thought they were mandatory if you made the semicolon explicit.
– kqr
Dec 25 '14 at 14:27
@kqr Didn't read the Haskell report fully, but you can see that's what they have demonstrated in the example withlet
.
– Sibi
Dec 25 '14 at 15:50
@Sibi Thank you.
– Stanko
Dec 25 '14 at 16:29
add a comment |
Semicolon anywhere is equivalent to a change of line indented to the same level as the previous valid expression.
I saw it by going through how indentation works (https://en.wikibooks.org/wiki/Haskell/Indentation).
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f27646966%2fmeaning-of-a-semicolon-in-lambda-expression%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
They just separate the two expression f x
and return x
in do notation. In fact these all are equivalent in your case:
iofunc_ s f = Command s (x -> do f x ; return x)
iofunc_ s f = Command s (x -> do f x ; return x)
iofunc_ s f = Command s (x -> do f x
return x)
iofunc_ s f = Command s (x -> f x >> return x)
1
When can you omit the curly braces? I always thought they were mandatory if you made the semicolon explicit.
– kqr
Dec 25 '14 at 14:27
@kqr Didn't read the Haskell report fully, but you can see that's what they have demonstrated in the example withlet
.
– Sibi
Dec 25 '14 at 15:50
@Sibi Thank you.
– Stanko
Dec 25 '14 at 16:29
add a comment |
They just separate the two expression f x
and return x
in do notation. In fact these all are equivalent in your case:
iofunc_ s f = Command s (x -> do f x ; return x)
iofunc_ s f = Command s (x -> do f x ; return x)
iofunc_ s f = Command s (x -> do f x
return x)
iofunc_ s f = Command s (x -> f x >> return x)
1
When can you omit the curly braces? I always thought they were mandatory if you made the semicolon explicit.
– kqr
Dec 25 '14 at 14:27
@kqr Didn't read the Haskell report fully, but you can see that's what they have demonstrated in the example withlet
.
– Sibi
Dec 25 '14 at 15:50
@Sibi Thank you.
– Stanko
Dec 25 '14 at 16:29
add a comment |
They just separate the two expression f x
and return x
in do notation. In fact these all are equivalent in your case:
iofunc_ s f = Command s (x -> do f x ; return x)
iofunc_ s f = Command s (x -> do f x ; return x)
iofunc_ s f = Command s (x -> do f x
return x)
iofunc_ s f = Command s (x -> f x >> return x)
They just separate the two expression f x
and return x
in do notation. In fact these all are equivalent in your case:
iofunc_ s f = Command s (x -> do f x ; return x)
iofunc_ s f = Command s (x -> do f x ; return x)
iofunc_ s f = Command s (x -> do f x
return x)
iofunc_ s f = Command s (x -> f x >> return x)
answered Dec 25 '14 at 12:08
SibiSibi
31.2k9 gold badges65 silver badges129 bronze badges
31.2k9 gold badges65 silver badges129 bronze badges
1
When can you omit the curly braces? I always thought they were mandatory if you made the semicolon explicit.
– kqr
Dec 25 '14 at 14:27
@kqr Didn't read the Haskell report fully, but you can see that's what they have demonstrated in the example withlet
.
– Sibi
Dec 25 '14 at 15:50
@Sibi Thank you.
– Stanko
Dec 25 '14 at 16:29
add a comment |
1
When can you omit the curly braces? I always thought they were mandatory if you made the semicolon explicit.
– kqr
Dec 25 '14 at 14:27
@kqr Didn't read the Haskell report fully, but you can see that's what they have demonstrated in the example withlet
.
– Sibi
Dec 25 '14 at 15:50
@Sibi Thank you.
– Stanko
Dec 25 '14 at 16:29
1
1
When can you omit the curly braces? I always thought they were mandatory if you made the semicolon explicit.
– kqr
Dec 25 '14 at 14:27
When can you omit the curly braces? I always thought they were mandatory if you made the semicolon explicit.
– kqr
Dec 25 '14 at 14:27
@kqr Didn't read the Haskell report fully, but you can see that's what they have demonstrated in the example with
let
.– Sibi
Dec 25 '14 at 15:50
@kqr Didn't read the Haskell report fully, but you can see that's what they have demonstrated in the example with
let
.– Sibi
Dec 25 '14 at 15:50
@Sibi Thank you.
– Stanko
Dec 25 '14 at 16:29
@Sibi Thank you.
– Stanko
Dec 25 '14 at 16:29
add a comment |
Semicolon anywhere is equivalent to a change of line indented to the same level as the previous valid expression.
I saw it by going through how indentation works (https://en.wikibooks.org/wiki/Haskell/Indentation).
add a comment |
Semicolon anywhere is equivalent to a change of line indented to the same level as the previous valid expression.
I saw it by going through how indentation works (https://en.wikibooks.org/wiki/Haskell/Indentation).
add a comment |
Semicolon anywhere is equivalent to a change of line indented to the same level as the previous valid expression.
I saw it by going through how indentation works (https://en.wikibooks.org/wiki/Haskell/Indentation).
Semicolon anywhere is equivalent to a change of line indented to the same level as the previous valid expression.
I saw it by going through how indentation works (https://en.wikibooks.org/wiki/Haskell/Indentation).
answered Oct 12 '17 at 9:49
hhefestohhefesto
1158 bronze badges
1158 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f27646966%2fmeaning-of-a-semicolon-in-lambda-expression%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
It's part of the
do
-notation, not the lambda.– augustss
Dec 25 '14 at 12:08