Skip to content

Conversation

@Steffan153
Copy link

@Steffan153 Steffan153 commented Sep 17, 2021

Closes #2357

My checklist:

  • Write introduction
  • Write instructions
  • Write tests
  • Write skeleton file
  • Write exemplar file
  • Write hints
  • Write config.json
  • Write design.md
  • Write concept introduction.md
  • Write concept about.md
  • Write concept config.json
  • Add something about using sorted

@Steffan153 Steffan153 marked this pull request as ready for review September 17, 2021 17:21
@Steffan153
Copy link
Author

I'm not sure what to put in about.md. I think somtehing about sorted would be good, but I'm not sure how to relate it with secrets. Maybe the secret has somtehing do do iwth the key?

@Steffan153 Steffan153 requested a review from BethanyG September 17, 2021 17:23
@Steffan153
Copy link
Author

I rigged up something for the sort.

@Steffan153 Steffan153 requested a review from BethanyG September 18, 2021 01:54
@Steffan153
Copy link
Author

Btw, how do I tell if the CI is failing or not? 🤔

@BethanyG
Copy link
Member

Btw, how do I tell if the CI is failing or not? 🤔

It usually shows here on the main page...buuut the workflow needs to be approved by a maintainer, so if you then do another push, it gets hidden until the workflow gets approved/run again.

@BethanyG
Copy link
Member

BethanyG commented Sep 18, 2021

ooof I think I need to take a break and look at this with fresh eyes in the morning (after 6am Pacific). Apologies, @Steffan153 -- I am a bit blurry at the moment, so please bear with me. I'll also have some ideas for the about.md in the morning. Promise. 😄

@Steffan153
Copy link
Author

I'm just 1 hour ahead of you and am a super heavy sleeper (I'm about to buy one of those bed shakers), so that should be plenty good :)

@Steffan153
Copy link
Author

Hey, just wondering what happened with this?

@BethanyG
Copy link
Member

Hi @Steffan153 -- I got pulled into troubleshooting, and then this slipped through the cracks. But I am reviewing today. Apologies.

@BethanyG
Copy link
Member

@Steffan153 -- I have really been struggling with this exercise, and how to adapt it better to Python.
Much of it feels like an exercise on higher order functions as opposed to lambda itself. Especially the line from the instructions:

In this exercise, you've been tasked with writing the software for an encryption device that works by performing transformations on data. You need a way to flexibly create complicated functions by combining simpler functions together.

The most "natural" way to do this in Python would be to simply write a function that takes or returns a function -- not by writing/returning a lambda.

I am also struggling with this, from the introduction:

Python has a [lambda][lambdas] expression, which is a shorter way to create functions than using def.

...because it is perfectly fine in Python to define a one-line named function. Mind you, it is considered pretty bad form, but this will compile and run without issue: def one_liner(first, second): first=first**2; second=second-3; return first + second

So I am trying to think through how to modify tasks 1 & 2 to better show where or why you would need a lambda instead of a simple (and named) one-line function.

I think task 3 can be modified to use max() and or min() with a key function.

Task 5 ... might be able to be modified to pull functions from a dict based on a key function. The other thought is to set up a scenario where one or more of these functions are callbacks that need parameters ... which would be where you might use a lambda instead.

The long and short : This exercise needs work - but it is around clarifying what topics are, and are not covered. I would suggest in-line edits, but I am not sure that is useful, since they would be less edits, and more entire re-writes. So I am inclined to "optimistically merge" this, and then discuss how we re-work it.

The other option is to turn this exercise into the start of a concept exercise on higher order functions, and pick a different scenario/topic for lambda that is more tailored to the restrictions Python places on them. I came across this from David Beazley, which could maybe be inspiration for a different exercise on lambda.

Thoughts on how you would like to proceed? Let me know. Thanks!

@Steffan153
Copy link
Author

Steffan153 commented Sep 22, 2021

What if we have this learn both the Lambdas concept and the Higher-Order Functions? Sounds like they would go well together.

because it is perfectly fine in Python to define a one-line named function.

The main advantage is that they're nameless in that case. (Well, and for.... well... yes.... code golf.) I will update that to be clearer.


I'll work on this later.

@BethanyG BethanyG added the on hold ✋🏽 Action should stop on this issue or PR for now. label Oct 5, 2021
@BethanyG BethanyG marked this pull request as draft October 7, 2021 16:26
@BethanyG BethanyG changed the title Add Secrets draft [New Concept Exercise on lambda]: Add Secrets draft Oct 8, 2021
@BethanyG
Copy link
Member

BethanyG commented Oct 9, 2021

@Steffan153 -- are you still up for working on this? Let me know...thanks!

@Steffan153
Copy link
Author

Still working on this. Thanks

@BethanyG
Copy link
Member

@Steffan153 -- Just checking in again. Are you still working on this?

@Steffan153
Copy link
Author

Yeah I'll get to it sometime...

@BethanyG
Copy link
Member

I'm going to close for now to clear the queue. Ping @J08K or myself when you are ready, and we will happily re-open.

@safwansamsudeen
Copy link
Contributor

@Steffan153 can we work on this together, if you're fine with that? This seems interesting.

@BethanyG
Copy link
Member

@safwansamsudeen -- This exercise is closed to contribution at this time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

on hold ✋🏽 Action should stop on this issue or PR for now.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OLD anonymous-functions (lambdas) concept exercise

4 participants