Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

new recipes #43

Merged
merged 10 commits into from
Apr 6, 2024
Merged

new recipes #43

merged 10 commits into from
Apr 6, 2024

Conversation

jcubic
Copy link
Contributor

@jcubic jcubic commented Aug 12, 2021

Few recipes (some from my implementation as-is and some modified). The best IMHO is sorted? it can be renamed to ordered? using two other recipes.

I think that my take function, which is part of SRFI-1, is better because the list should be the last argument, otherwise you can't curry easily that function. The same argument I've seen in a video some time ago about Lodash (and underscore) JavaScript libraries, that had broken arguments and you could not use curry with them. Because an array was the first argument.

@arthurgleckler
Copy link
Contributor

arthurgleckler commented Aug 12, 2021 via email

@jcubic
Copy link
Contributor Author

jcubic commented Aug 12, 2021

I have in fact implementation of this function in my Scheme, I took those functional programming tools, from RambdaJS library that have very well defined API for function manipulation.

(define (flip fn)
  "(flip fn)

   Higher order function that return new function where first two arguments are swapped.

   Example:

     (define first (curry (flip vector-ref) 0))
     (first #(1 2 3))
     ;; ==> 1"
  (typecheck "flip" fn "function")
  (lambda (a b . rest)
    (apply fn b a rest)))

This is how this function works in Ramda, it swap first two arguments.

@lassik
Copy link
Member

lassik commented Aug 13, 2021

SRFI 197: Pipeline Operators solves the problem another way: you type an underscore _ in the place where the argument should be inserted.

@lassik
Copy link
Member

lassik commented Aug 13, 2021

The argument order of take is indeed cumbersome. map and for-each are even worse! But defining new standard procedures with the order flipped would probably cause more confusion than it solves, since we would end up with two procedures that do the same job. Using flip or chain in one's own program is a good solution.

@jcubic
Copy link
Contributor Author

jcubic commented Aug 13, 2021

Will change take to be the same as inn SRFI then.

@jcubic
Copy link
Contributor Author

jcubic commented Aug 14, 2021

@lassik I also added another solution for the map recipe since you can understand the problem in two ways.

* use take function argument order from SRFI-1
* use loop name in let
* add another example to seq-map
* use another solution for map-over-sequence of elements recipe
* change name to sublist-map
* add suggested example
Make the name different than SRFI to not confuse people
@jcubic jcubic requested a review from lassik February 22, 2022 22:02
@jcubic
Copy link
Contributor Author

jcubic commented Feb 22, 2022

Hi, sorry about the late response. I was busy with other things. I've updated the code. in some cases, I used two implementations, added a link to SRFI, or renamed the function.

@jcubic
Copy link
Contributor Author

jcubic commented Mar 24, 2024

I've changed the Map over n consecutive elements recipe to only be called to full length sub lists.

What else needs to be done here?

@jcubic jcubic mentioned this pull request Mar 24, 2024
@lassik
Copy link
Member

lassik commented Apr 6, 2024

Sorry, I'm too slow to respond to these updates in a timely manner. Scheme.org should add content faster, and I should not be a gatekeeper that slows it down.

If you don't get a response from anyone within a day, just add what you think is needed. We can always change and revert things later.

We use rsync to upload everything to our Linux server. Let me know if you want an account there.

@lassik lassik merged commit 1682c75 into master Apr 6, 2024
@lassik lassik deleted the recipes branch April 6, 2024 14:51
@lassik
Copy link
Member

lassik commented Apr 6, 2024

Now up at https://cookbook.scheme.org/

@jcubic
Copy link
Contributor Author

jcubic commented Apr 6, 2024

Do you manually copy the files? Maybe it's good idea to setup GitHub action that will upload the files to the server after merge.

Let me know if you need help with this. I can setup the workflow, but I need to know how to build the files, and you will need to add SSH key into secrets of the repo, I'm not sure if you can do this on org level. I use scp in one of the project to build website and upload to the server/hosting.

You can see similar workflow here (for my personal blog):

https://github.com/jcubic/jankiewicz/blob/master/.github/workflows/build.yaml

It requires Private SSH key as secret in the repo. But only the person that add the secret can see it, so it's safe for one admin to add the secret and not need to worry that other will see it.

@arthurgleckler
Copy link
Contributor

arthurgleckler commented Apr 6, 2024 via email

@lassik
Copy link
Member

lassik commented Apr 6, 2024

If we can make a Docker container that builds the HTML files (using our Scheme scripts) and uploads them using rsync, that would be ideal IMHO. We can make a dedicated SSH account for CI jobs if it helps.

@lassik
Copy link
Member

lassik commented Apr 6, 2024

We just have to keep up with the reviews. I've been trying to keep up, but must have missed some.

It's inevitable. Lisp doesn't attract enough people with the right personality to maintain good websites on a fast schedule.

The GNU sites are the only professional-looking Lisp sites. Even Clojure doesn't have a sleek website though many commercial companies are using it.

Do-ocracy in all the details has to be the main driver of Scheme.org -- once we have written the charter to ensure that the basic structure and technical choices behind the site enjoy wide agreement.

@arthurgleckler
Copy link
Contributor

arthurgleckler commented Apr 6, 2024 via email

@arthurgleckler
Copy link
Contributor

arthurgleckler commented Apr 6, 2024 via email

@lassik
Copy link
Member

lassik commented Apr 6, 2024

Sorry, the outdated installation instructions are my fault. Thank you for fixing them.

@jcubic
Copy link
Contributor Author

jcubic commented Apr 6, 2024

I will create an issue for the workflow, so it's easier to find.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants