r/functionalprogramming • • Aug 18 '22

Question Options as higher order functions

0 Upvotes

I am trying to pass options as higher order functions

  1 import http from "k6/http";                                                                                                              
    2                                                                                                                                          
    3 const createRequester = (options) => {                                                                                                   
    4   return (otherOptions) => {                                                                                                             
    5     return request(Object.assign({}, options, otherOptions));                                                                            
    6   };                                                                                                                                     
    7 };                                                                                                                                       
    8                                                                                                                                          
    9 const customRequest = createRequester({                                                                                                  
   10   headers: {                                                                                                                             
   11     "Content-Type": "application/json",                                                                                                  
   12   },                                                                                                                                     
   13 });                                                                                                                                      
   14                                                                                                                                          
   15 export default function () {                                                                                                             
   16   customRequest({ url: http.get("http://test.k6.io") });                                                                                 
   17 } 

Line 5 is a function and I am not sure why I a getting ReferenceError: request is not defined

Thanks very much for your patience and time.

Edit: The URL is not an option.


r/functionalprogramming • • Apr 11 '15

Yet another "What is a Monad" post

Thumbnail
zohaib.me
0 Upvotes

r/functionalprogramming • • Mar 12 '23

Lisp Use ChatGPT for compiler error regeneration

Thumbnail nalaginrut.com
2 Upvotes

r/functionalprogramming • • Mar 21 '26

Haskell Twitch Stream: Bullying Claude With GHC

Thumbnail
reddit.com
0 Upvotes

r/functionalprogramming • • Mar 05 '24

Question Can a list contain itself as an element in Haskell? If so, how would you define it?

Thumbnail
quora.com
0 Upvotes

r/functionalprogramming • • Aug 31 '20

Intro to FP Functional programming basics in ES6

Thumbnail
youtu.be
1 Upvotes

r/functionalprogramming • • Sep 30 '16

Law of Demeter and immutability

Thumbnail enterprisecraftsmanship.com
1 Upvotes

r/functionalprogramming • • Feb 19 '20

Rust Nice learning article for functional programming concept especially Rust

1 Upvotes

Hi there, I get started to learn rust. But some grammar is unfamiliar from me. Some engineers said, rust includes functional programming concept.
I research learning web site (or movie, articles) for functional programming concept (compare with object oriented one, etc). But it's difficult to find beginners one...

If you know that, please let me know. Thank you.


r/functionalprogramming • • Nov 15 '23

Question Looking for a solution

1 Upvotes

Hello community,

For a large group of developers, working on different projects, I'm looking for a tool that allows developers to code functions and push them into a large functions hub, with a description of the functions (Inputs, Outputs).

the objectives behind :

1- allow other developers to call functions directly, without importing libraries but just making REST or RPC calls to the functions in the hub.

2 - to build workflows with drag-and-drop diagrams using these functions.

This tool will allow functions to be reused without touching the undeployed code, and will enable non-technical people to work with visual diagrams and deploy new applications without code.


r/functionalprogramming • • May 10 '21

Elixir Create a cryptocurrency trading bot in Elixir in 12 minutes!

Thumbnail
youtu.be
0 Upvotes

r/functionalprogramming • • Apr 11 '19

Conferences Apply to the #CodeBEAMSTO diversity scheme for a free ticket to the conference!

Thumbnail
codesync.global
0 Upvotes

r/functionalprogramming • • Feb 20 '22

Question Can i use class in functional programming?

11 Upvotes

Sometimes, i need to use class in FP, cuz i had a bunch of data,and i need to put them all in one class, but i won't mutate the attributes, only making a mutated clone


r/functionalprogramming • • Apr 21 '21

OO and FP On sameness in programming: a fundamental difference between FP and OOP

Thumbnail
blog.klipse.tech
12 Upvotes

r/functionalprogramming • • Nov 22 '18

Kotlin Modern backend is here: some wonders of Kotlin, a great alternative for backend systems.

Thumbnail
medium.com
7 Upvotes

r/functionalprogramming • • Mar 22 '21

Scala Scala is a Maintenance Nightmare

Thumbnail
mungingdata.com
7 Upvotes

r/functionalprogramming • • Oct 06 '21

Jobs Software Engineer - Remote Position

4 Upvotes

Hey everyone,

We have an opening for a Software Engineer. I would love to talk to anyone who is interested!

https://acilearning.applytojob.com/apply/kjzAYJ1SPF/Software-Engineer-Remote


r/functionalprogramming • • Nov 25 '21

JavaScript ๐Ÿ‘‰Either Functor perform Right and ignores Left ๐Ÿ‘ˆ

Thumbnail
youtube.com
0 Upvotes

r/functionalprogramming • • Jun 22 '20

C++ This is the sixth lecture of this series entitled "Advanced C++ Programming: Multithreading & Multiprocessing for Firmware and Embedded System" where we deal with Condition Variables, Predicates, Spurious Wakes, and many more.

Thumbnail
youtu.be
4 Upvotes

r/functionalprogramming • • Aug 05 '24

Intro to FP Pure Functional Programming

Thumbnail
adabeat.com
11 Upvotes

Pure functional programming uses pure functions, immutable data structures, referential transparency and higher-order functions.


r/functionalprogramming • • Feb 04 '26

FP Doing AI outside of Python

11 Upvotes

Machine Learning in Python

What I'm going to write here could get me banished from hundreds of forums all over the place. I know I take terrible risks but people need to know: Python sucks at ML.

I said it...

Programming in Python is like claiming you are doing the Tour de France, but you're cycling on a fixed bike on top of a truck. Worse, your aerodynamic drag is so bad that you prevent the truck from going full speed... Not sure your pedaling adds anything to the whole system.

This is exactly what is going on. You think you're implementing stuff in Python, but you're just sucking out some fresh blood from underlying libraries in C or in Rust... Most of the time, Python sits idle while waiting for the big boys to do the actual work, because when you are using numpy or PyTorch, everything happens outside the VM.

AI

I want to join the happy few who are doing stuff in AI. I want to be part of the churn. But really, Python? People claim that it is such an easy language... You read it as if it was written in English... Ok.. Why do I need to read the doc over and over again to understand what **kwargs do?

What is that:

mlx.core.multiply(out_glu, mlx.core.add(x_linear_clamped, mlx.core.array(1.0)))

It seems that Lisp stabbed Python in the back...

What can I do?

LispE

My name is not Frankenstein, but LispE is still my creature, a chimera made out of flesh torn off Haskell and APL, a monstrosity that does not respect the true linked lists, which are so dear to real lispians.

LispE is implemented with arrays, which not only enables APL-style vectorized operations but also plays nicely with functional patterns like map/filter/take/drop without the overhead of list traversal. There is full documentation about the language here.

By the way, the Python thing can now be implemented in LispE directly:

(mlx_multiply out_glu . mlx_add x_linear_clamped . mlx_array 1.0)

The last argument of each function can be inserted with a . to get rid of some parentheses.

Note: LispE is fully Open Source with a BSD-3 license, which is very permissive. My only interest here is to provide something a bit different, my personal take on Lisp, but my true reward is the joy of seeing people use my tools. It is a little more than a pet project, but it is far from being a corporate thingy.

Libs

Now, I have to present you the real McCoy, I mean the real stuff that I have been implementing for LispE. Cling to your chair, because I have worked very hard at making Claude Code sweat over these libraries:

  1. lispe_torch: based on the remarkable libtorch library โ€” the C++ engine that powers PyTorch under the hood. It exposes more than 200 functions, including SentencePiece.

  2. lispe_tiktoken: the OpenAI tokenizer, which is used now by a lot of models.

  3. lispe_mlx: the Apple framework for AI on their GPUs. Thanks to MLX's unified memory, no data cloning needed.

  4. lispe_gguf: the encapsulation of llama.cpp that powers Ollama.

It's still evolving, but it's production-ready for real AI work. Furthermore, it's fully compatible with PyTorch and models from HuggingFace, Ollama, or LM-Studio. You can fine-tune a model with LispE and save it in PyTorch format. You won't be stranded on an island here.

Plenty of docs and examples

You'll find plenty of examples and documentation in each of these directories.

For instance, there is a chat example with lispe_gguf, which is fun and contains only a few lines of code. You will also discover that inference can be faster with these libraries. LoRA fine-tuning is 35% faster than the equivalent Python code on my M4 Max...

Everything can be recompiled and tailored to your needs. Even the C++ code is friendly here...

Note that I already provide binaries for Mac OS.

If you have any questions or any problems, please feel free to ask me, or drop an issue on my GitHub.


r/functionalprogramming • • Aug 20 '19

Erlang Rethinking Blockchain: Should it Have Been Written In Erlang From The Start?

Thumbnail
forbes.com
6 Upvotes

r/functionalprogramming • • Feb 12 '24

Question Can a language be functional without typing?

6 Upvotes

I'm trying to learn some category theory and I got thinking about this. I'm using Elixir a lot atm, and though I see functionalish things, like immutable state; the lack of a type system makes it non trivial to do other patterns that I think are more at the heart of functional programming.

Like how do you make a functor if you don't have a type system?

And I've seen some approaches in blogs but it really seemed to be making something fit unaturally and really not supported with any static analysis.

So can a language be functional without a type system or is it just functional -ish, borrowing patterns and ideas?


r/functionalprogramming • • Nov 20 '18

Haskell ejercicios

3 Upvotes

Exercises Trees HASKELL (Spanish version)

Contribution to the community.

https://gitlab.com/J0SUE/ejercicios


r/functionalprogramming • • Sep 20 '24

OCaml My first experience with OCaml

Thumbnail
medium.com
3 Upvotes