![Community banner](https://programming.dev/pictrs/image/af4728b1-480a-4deb-b337-fdb24eb739eb.jpeg)
-
Factor Cannot apply “call” to a run-time computed value
I wanted to map over a nested array in factor so I created a helper function:
: nested-map ( a quote -- a' ) swap [ over map ] map nip ;
which i then called with
{ { 1 2 } { 3 4 } } [ 1 + ] nested-map
But when I call it I get the error from the title.
If I just paste the body of the function it works as intended:
{ { 1 2 } { 3 4 } } [ 1 + ] swap [ over map ] map nip
So I guess I have two questions: is there a better way to achieve the original goal, but also how am I supposed to create higher order functions without getting this error?
-
The Forth Deck mini: a portable Forth computer with a discrete CPU
Discussion on hacker news: https://news.ycombinator.com/item?id=40804122
-
As you learn Forth, it learns from you (1981)
I'm posting this mostly for the new hacker news discussion: https://news.ycombinator.com/item?id=40736174
-
F: Functional False
> F is a pure functional concatenative language originally designed as an extension of False. F contains the list-operations of K3 and the dip combinator of Joy. Floating-point and symbolic datatypes are supported. One-time assignment is enforced in syntax. A theory of function-valence and -charge is outlined. F also contains a general continuation primitive $, and the pattern sublanguage of XY. G is a variant of F in which the K3 adverbs are implemented as primitives.
Discussion on lobsters: https://lobste.rs/s/m9xv5y/f_functional_false
-
Cognate: Readable and concise concatenative programming | Discussion on Lobsters
This is already in the sidebar, but now there's a fresh post on Lobsters, so maybe some good discussion will come of it.
-
Discussion on lobsters: https://lobste.rs/s/mwbsed/first_class_contexts
-
Forsp: A Forth+Lisp Hybrid Lambda Calculus Language
- Discussion on lobsters: https://lobste.rs/s/l8o4j8/forsp_forth_lisp_hybrid_lambda_calculus
- Repo: https://github.com/xorvoid/forsp/
-
Discussion on lobsters: https://lobste.rs/s/fxkhfk/failing_at_combinatorics_with_haskell
-
0.1 + 0.2 | Roc
Discussion on lobsters: https://lobste.rs/s/oxjvv0/0_1_0_2
> It's not that Roc only supports base-10 arithmetic. It also supports the typical base-2 floating-point numbers, because in many situations the performance benefits are absolutely worth the cost of precision loss. What sets Roc apart is its choice of default; when you write decimal literals like 0.1 or 0.2 in Roc, by default they're represented by a 128-bit fixed-point base-10 number that never loses precision, making it reasonable to use for calculations involving money.
> In Roc, floats are opt-in rather than opt-out.
- ryelang.org Go's concurrency in a dynamic language Rye
The Rye programming language is a dynamic scripting language based on REBOL’s ideas, taking inspiration from the Factor language and Unix shell. Rye is written in Go and inherits Go’s concurrency capabilities, including goroutines and channels. Recently, Rye gained support for Go’s select and waitgr...
lobsters discussion: https://lobste.rs/s/mnuhwc/go_s_concurrency_dynamic_language_rye
-
Working with The Simple Text Oriented Messaging Protocol (STOMP) in Factor | Re: Factor
From the STOMP homepage:
> ### What is it?
> STOMP is the Simple (or Streaming) Text Orientated Messaging Protocol.
> STOMP provides an interoperable wire format so that STOMP clients can communicate with any STOMP message broker to provide easy and widespread messaging interoperability among many languages, platforms and brokers.
> ### Simple Design
> STOMP is a very simple and easy to implement protocol, coming from the HTTP school of design; the server side may be hard to implement well, but it is very easy to write a client to get yourself connected. For example you can use Telnet to login to any STOMP broker and interact with it!
From John's blog post:
> In the interest of learning Factor, I thought I would write a bit about parsing the STOMP protocol, and then about how to implement a client library using connection-oriented networking, interacting with it using mailboxes, and then building a command-line interface using the command-loop vocabulary.
> There are many STOMP servers and clients available in different languages. I tried a few and decided that Apache ActiveMQ was one of the most convenient to setup and reliable to work with, but others are available as well.
-
Forth Bitcoin miner for PC and Game Boy
YouTube Video
Click to view this content.
Discussion on lobsters
-
Factor Programming Language Tutorial | Video
odysee.com Factor Programming Language TutorialThis is an introductory tutorial for a stack-based (concatenative) programming language Factor. It covers some basic language constructs and a few features of the interactive development environment t...
John B's blog post calls it:
> . . . a pretty neat hour long introduction going over a lot of features that users new to the language might be interested in.
The video creator's description:
> This is an introductory tutorial for a stack-based (concatenative) programming language Factor. It covers some basic language constructs and a few features of the interactive development environment that is shipped with Factor.
> I've re-shot my two prior recordings combining everything into a single video.
-
akalenuk/the_namingless_programming_language: Naming is hard. How far can we go without?
github.com GitHub - akalenuk/the_namingless_programming_language: Naming is hard. How far can we go without?Naming is hard. How far can we go without? Contribute to akalenuk/the_namingless_programming_language development by creating an account on GitHub.
Discussion on lobsters: https://lobste.rs/s/r50zeq/ukrainian_coder_s_new_programming
- blog.zdsmith.com Subset Park: Combinatory Programming
Combinatory Programming : ## To The Programmer A combinator is a kind of function. Specifically, it's a function that applies its arguments---and only its arguments---to each other in a particular shape
-
Introducing pql, a pipelined query language that compiles to SQL (written in Go)
blog.runreveal.com Introducing pql, a pipelined query language that compiles to SQL (written in Go).Today we're open-sourcing pql under the Apache 2.0 license and announcing that all RunReveal customers can use pql to query their logs. We built pql because the major security vendors use proprietary languages as a source of vendor lock-in and there were no open-source alternatives. pql is SQL agnos...
- https://blog.runreveal.com/introducing-pql/
- https://pql.dev/
- https://github.com/runreveal/pql
I don't yet have a feel for any key differences between pql and PRQL.
-
tomhrr/cosh: Concatenative command-line shell
github.com GitHub - tomhrr/cosh: Concatenative command-line shellConcatenative command-line shell. Contribute to tomhrr/cosh development by creating an account on GitHub.
Copied from the readme:
---
cosh is a concatenative command-line shell.
Why?
Basic shell operations like
ls
,ps
,stat
, and so on are implemented as functions that return first-class values, as opposed to relying on executables that return text streams. This makes working with the results simpler:- Find file paths matching a string, and search those files for data
sh:
sh find . -iname '*test*' -print0 | xargs -0 grep data
cosh:sh lsr; [test m] grep; [f<; [data m] grep] map
- Find all processes using more than 500M of memory:
sh:
sh ps --no-headers aux | awk '$6>500000'
cosh:sh ps; [mem get; 1000 1000 *; 500 *; >] grep
A small set of versatile primitives means that less needs to be remembered when compared with typical shells (see e.g. the various flags for
cut(1)
), though some commands may be longer as a result:- Get the second and third columns from each row of a CSV file:
sh:
sh cut -d, -f2,3 test-data/csv
cosh:sh test-data/csv f<; [chomp; , split; (1 2) get] map
- Sort files by modification time:
sh:
sh ls -tr
cosh:sh ls; [[stat; mtime get] 2 apply; <=>] sortp
Arithmetical operators and XML/JSON/CSV encoding/decoding functions reduce the number of times that it becomes necessary to use a more full-featured programming language or a third-party executable:
- Increment floating-point numbers in file:
sh:
sh sed 's/$/+10/' nums | bc
cosh:sh nums f<; [chomp; 10 +] map
- Get the first value from the "zxcv" array member of a JSON file:
sh:
sh jq .zxcv[0] test-data/json2
cosh:sh test-data/json2 f<; from-json; zxcv get; 0 get
It also integrates with external executable calls, where that is necessary:
- Print certificate data:
bash:
bash for i in `find . -iname '*.pem'`; do openssl x509 -in $i -text -noout; done
cosh:sh lsr; [pem$ m] grep; [{openssl x509 -in {} -text -noout}] map;
See the full documentation for more details.
-
Show off your solutions to Exercism's 48in24, but in your favorite stacky lang!
exercism.org The #48in24 ChallengeTry out a new programming challenge each week. Broaden your horizons and level up your programming skills as your explore the varied paradigms and ideas that different languages embrace. It's free, fun, and useful!
Just because Exercism doesn't offer your favorite language as an official track, it doesn't mean we can't play at all. Post some solutions to the weekly challenges in the language of your choice!
-
StonkDragon/Scale: A procedual concatenative stack-oriented compiled programming language inspired by Porth.
github.com GitHub - StonkDragon/Scale: A procedual concatenative stack-oriented compiled programming language inspired by Porth.A procedual concatenative stack-oriented compiled programming language inspired by Porth. - StonkDragon/Scale
Copied from the project's readme:
---
Introduction
Scale is a procedual and object oriented concatenative stack oriented compiled programming language inspired by Lua and Porth.
The Compiler is a source-to-source compiler, as it converts your source code to valid C code, that is then compiled by Clang.
Scale supports both 32-bit and 64-bit systems, but 64-bit is strongly recommended.
Examples
Examples can be found in the examples directory.
Installation
Run the following commands:
shell $ clang++ install-sclc.cpp -o install-sclc -std=gnu++17 $ ./install-sclc
Documentation
A list of all features can be found here.
The Scale Framework documentation can be viewed by running the following command:
shell $ sclc -doc-for Scale
-
acook/blacklight: a stack-based concatenative virtual machine for implementing highly concurrent languages
github.com GitHub - acook/blacklight: a stack-based concatenative virtual machine for implementing highly concurrent languagesa stack-based concatenative virtual machine for implementing highly concurrent languages - acook/blacklight
Copied from the project's readme:
---
-
blacklight
is a programming language which is concurrent, stack-based, and concatenative (BLPL) -
blacklight
is a virtual machine for implementing highly concurrent languages (BLVM) -
blacklight
is a data interchange format for communicating between processes and across networks (BLBC)
Features --------
blacklight (BLVM) is awesome, here's a few reasons why:
- easy to use builtin parallelism through native concurrency primatives
- threadsafe communication between concurrency units
- rich datatype primitives
- an easy to use homoiconic Forth-like assembly language (BLPL)
- runtime bytecode manipulation and generation
- UTF-8 native datatypes
- multi-architecture and cross-platform (currently: x86_64, ARM, macos, linux, windows)
- (in progress) highly optimized vector operations on supported CPUs
- (planned) security contexts and permissions
Documentation -------------
- The blacklight Wiki has documentation and links (work in progress).
- The examples directory contains several demonstration scripts to get you started.
BLPOC -----
The current implementation of
blacklight
is a proof-of-concept. It's functional but intended primarily for proving out features, strategies, and specifications. Once The ABI is stable it will be reimplemented with optimization and compatibility in mind against a full test suite. As is, there is very little aboutblacklight
that isn't subject to change to better reflect the results of research and experimentation. -
-
Example programs page added to the The Concatentatice wiki
A new wiki page has been started to show case example programs in various catlangs.
-
From the homepage:
> Rye is a high level, homoiconic dynamic programming language based on ideas from Rebol, flavored by Factor, Linux shell and Go. It's still in development, but we are focused on making it useful as soon as possible.
> It's written in Go and could also be seen as Go's scripting companion as Go's libraries are very easy to integrate, and Rye can be embedded into Go programs as a scripting or a config language.
> I believe that as a language becomes higher level it starts bridging the gap towards user interfaces. Rye has great emphasis on interactive use (Rye console) where we intend to also explore that.
-
Konilo: a small, pragmatic personal computing system written in Forth and running on a tiny virtual computer
Discussion on Hacker News: https://news.ycombinator.com/item?id=39570343
-
Hey that's me! No, not the amazing Factor dev that authored this post. No, not the contributor who jumped in and saved the day. I'm the
> one of the members of the Factor Discord server
who complained about numbers! Woohoo!